|
I'm about to begin my next web development project and wanted to hear about the merits of Lua within the web-development space.
How does Lua compare to PHP/Python/JSP/etc.. for web development?
Any reason why Lua would be a poor choice for a web application language vs the others?
|
|
asked Aug 20 '09 at 0:00
Ben
|
|
|
|
If you talk to Lua people, you will find that they are sensitive about the name. It is "Lua", because it is Portuguese for Moon, a proper noun. It is not an acronym.
–
RBerteig
Aug 20 '09 at 0:14
|
add comment
|
Many good questions generate some degree of opinion based on expert experience, but answers to this question
will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.
|
In brief:
Lua gives you a smaller, simpler system that you can understand in its entirety, but it is in a much smaller ecosystem; Kepler is all you get, and you will probably have to build some of your own stuff. I find this easy and fun (I make heavy use of the Lua bindings to the Expat parser and the Lua Object Model, which are part of Kepler), but others may prefer to use what everyone else is using. PHP started out as more of a macro processor than a language, and although it has improved over the years, when people say "X has really gotten a lot better", I tend to be wary of X. I find PHP offputting, but there is a huge ecosystem for web development. Python is a nice language but much bigger than Lua, and in the throes of a major revision (transition from 2.5 to 3.x). Again you get a big ecosystem; the problem I have with Python is that the language and system are too big for any one person to understand all of. I don't like to be in this situation if I don't have to. Ruby is a bit of a cleaner language design, and the large Rails ecosystem is a winner. Ruby is less complex than Python but more complex than Lua. Rails is a bit of a beast.
It comes down to this question:
Would you rather understand all the software in your system, even if you have to build a lot of things yourself? Or would you rather have a lot of things already built for you, even if you wind up not understanding exactly how every piece works?
If you want to understand everything, Lua is your game. If you want a lot of stuff already built for you, I can't advise you how to pick among PHP/Python/JSP/Rails and so on.
More on Lua and Python at Which language is better to use, Lua or Python?
|
answered Aug 20 '09 at 3:43
|
|
|
|
Hi Norman, would you mind adding a little comparison between LUA the language from static/dynamic typing ... strong/week typing etc... Thanks!
–
Ben
Aug 20 '09 at 4:11
|
|
"Ruby is a bit of a cleaner language design". Compared to what? I'd say that it's rather incoherent compared to Lua or Python. It's still a very elegant design, but I wouldn't call 7 (Depending on how you count) different types of anonymous functions clean. Good answer otherwise.
–
troelskn
Aug 20 '09 at 9:12
|
|
|
|
@Ben: I don't think I'm qualified to talk in detail about the differences in type systems---they're all dynamic. Not sure what types PHP has these days.
–
Norman Ramsey
Aug 20 '09 at 17:05
|
|
Please read this: /article/3882 . I don't think Python is complex. On the contrary. It's just that it's so easy and it's so powerful that you can make very complex things. That is a huge difference from what you're saying. With Python, its huge quality may be its drawback: people can write incredibly powerful things but if they're too clever for you, you may never be able to understand what they've done (so am I (not very clever)). And a lot of freeware stuff has been made by clever people so hard to understand.
–
Olivier Pons
Nov 17 '11 at 19:40
|
show 2 more comments
|
|
Using Lua for web development is pretty rare...you could do it, but it will be a lot more time consuming than using a language that has matured as a web developing language (PHP) or has good web related libraries (python/ruby/etc.) If you do go with Lua, this means you may end up "recreating the wheel" a lot for what may be easily available in mature web languages.
The better question is, what does Lua offer that you need which is not offered in the other languages you listed? Or do you want to help Lua become a better web development platform by creating a Lua MVC framework like Rails did for Ruby?
|
|
answered Aug 20 '09 at 0:12
|
|
|
|
The Lua language can be used in a procedural, functional, or object-oriented style (or a mix of all of the above) with natural idioms. As with most dynamic languages it gives you garbage collected storage. It is natural (and fair) to compare it to Python and other dynamic languages. But it is very much unlike using C++ for this kind of task.
–
RBerteig
Aug 20 '09 at 0:24
|
|
Yeah I guess it was a bad comparison, edited to clarify. I meant more along the lines of similar obscurity instead of a comparison as a type of programming language. My point is mostly that popular web languages have more tools or open source content for what typically leads to faster and more convenient development.
–
Glitz
Aug 20 '09 at 0:47
|
|
Didn't people say Ruby was an obscure language to use for web development and not these days, it's all the rage
–
Ben
Aug 20 '09 at 4:05
|
|
They did, before someone made Ruby on Rails. - Today Ruby is fine for web development because there are frameworks like Rails. Lua does not have suiteable web development frameworks like that (But maybe Kepler will get there)
–
nos
Aug 6 '10 at 23:41
|
add comment
|
|
The Kepler project is probably the best known starting point for web application development in Lua. They have a mailing list whose archives will have a lot of discussion of the merits of various approaches.
The Kepler site is itself built in a CMS framework called Sputnik written almost entirely in Lua, and based on the Kepler project.
The typical approach with Lua is to use a language suited to interfacing to various system components to implement those interfaces, and to use Lua for business logic and glue. Kepler provides libraries written largely in C that provide access to file systems, databases, and the network to Lua code. It also provides a defined API layer to interface with the web server, with implementations for Apache, any CGI capable server, and Xavante which is a complete web server implemented mostly in Lua.
|
|
answered Aug 20 '09 at 0:16
|
|
|
add comment
|
|
Python and Lua are my two favorite languages.
Lua is nice, but can be more work as a language in my experience. There are many things you need to implement yourself in Lua, starting with inheritance. I find Python superior to Lua in most respects, but Lua is fast, small, and great for certain, usually embedded, solutions.
I think Python's a good choice because it's a great language, but it has traditionally been more work than it should be to use for web development. Maybe things like Django change that, but I was fond of Pylons when I last looked into Python for web development. When I next do web development I will use Python. I've done it already, but always using a different platform/framework, so it hasn't been consistent.
PHP is great for web development, but not a great language. It is heavily integrated and can create solid applications, with great support and cheap hosting. I used to do a lot of PHP web development, and have had PHP hosting with pair.com for many years. I like the overall simplicity of the whole system even if the language can be hard on my wrists.
JSP is overkill.
|
answered Aug 20 '09 at 0:57
|
|
|
add comment
|
|
i'm coming a little late ... but i wanted to throw in another language: haXe
why?
haXe is an open source language, driven by a quite small, but active community haXe is a platform indepented language ... targets are:
- flash player 6-8 and 9-10 bytecode or ActionScript 3 source code
- JavaScript source code
- PHP source code
- NekoVM bytecode or Neko source code (NekoVM is a lightweight and extensible VM, suitable for both server developement, and desktop apps)
- C++ source code
- Android Java source code is currently being worked on
this means, that as a web developer, you can write both rich clients as well as servers in the same language ... the same code can be later reused for desktop/mobile apps - haXe is a very expressive and powerful language, featuring:
- first class functions (anonymous functions and methods, which are the same in haXe) and closures as well as Enums with parameters (much like algebraic types) that allow the use of functional approaches
- good type system, including generics, structural subtyping etc. ... to simplify its use, the compiler has a very helpful type inference, that ensures code is strictly typed, but saves you a lot of redundancy (variable type is determined by initialization, function return type by type of returned expressions) ...
- cross-platform API, including everything from dynamic arrays, to reflection/introspection and a remoting package, that alows you to send whole objects from client to server, from one platform to another ...
- consistent and radical language design ... of course it has a few flaws, but these mostly come from the fact, that it targets extremely different platforms ...
- girls love it and it'll make you real rich ... :D
the biggest flaw about haXe is, that it allows untyped coding, at the cost of platform specific execution of untyped code ... when well typed (which is not a lot of work with haXe in fact), code will be executed the same way on all platforms ... if not, result vary depending on runtime handling of the platform itself ...
to put it in a few words: it's a great language, that allows you to target many platforms ... it's young, it's growing, and you can participate ...
|
answered Aug 24 '09 at 22:40
|
|
|
add comment
|
|
If it's only the language, then I agree with Norman. If the web development framework is important to you, then you have to consider Ruby because RoR is a very mature framework. I love Python, but there seems to be quite a few frameworks to choose from, none of them is dominant. CherryPy, Django, Pylons, web2py, Zope 2, Zope 3, etc. One important indicator to me is that there are more RoR jobs on the market than any other (language, framework).
|
answered Jan 5 '10 at 19:31
|
|
|
add comment
|
|
As far as Lua web frameworks, there is also LuCI. It is mostly used for small embedded systems. We're just starting a project using it, so I can't comment on it too much right now. We're just doing some simple configuration screens similar to what is already provided as examples, so I'm sure it will be sufficient for our needs.
|
|
answered Sep 18 '09 at 15:11
James Graves
|
|
|
add comment
|
|
Kepler is not the only option, give a try to http:// a web framework build in Lua. It comes with a library of some common PHP-like functions http://github.com/ophal/seawolf which will help you understand Lua if you come from the PHP land.
|
|
answered Aug 6 '10 at 23:34 | |
|