views:

853

answers:

9

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?

+3  A: 

Using Lua for web development is as obscure as using C++ for web development...you could do it, but it sure is unusual and 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/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 the mature web languages.

The better question is, what does Lua offer that you need which is not offered in the other languages you listed?

Glitz
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
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
Didn't people say Ruby was an obscure language to use for web development and not these days, it's all the rage
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
+2  A: 

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.

RBerteig
+2  A: 

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.

kk
+8  A: 

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?

Norman Ramsey
Hi Norman, would you mind adding a little comparison between LUA the language from static/dynamic typing ... strong/week typing etc... Thanks!
"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
@troelskn: fair criticism. I learned Smalltalk years ago, and when I look at Ruby, I really only see Smalltalk...
Norman Ramsey
@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
+1  A: 

i'm coming a little late ... but i wanted to throw in another language: haXe

why?

  1. haXe is an open source language, driven by a quite small, but active community

  2. 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

  3. 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 ...
  4. 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 ...

back2dos
A: 

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.

A: 

<% ASP SUX %>

no real web designer has ever created a significant interactive website with Lua.

It is good for a few small projects, great for scripting in a program... horrible for web design.

Stick with the known open source stuff.

Eric S
+1  A: 

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).

grokus
+1 for pointing out the RoR job demand
mcpeterson
A: 

Kepler is not the only option, give a try to http://gitorious.org/nutria, might help you to understand why PHP is widely used.

develCuy