14 December 2006

Programming Languages Analyzed, Web Edition

Quite a lot of time passed since my last post. My job and my family are taking up a lot of my time that should be spent on my future business. I promised in a comment that I would do a web edition for the Programming Languages Analyzed post. Since I haven't used web technologies in the last three years, I had to look up a lot of things that appeared in the mean time: AJAX, Ruby on Rails etc. So, without further ado, here we go analyzing the programming languages and their associated frameworks that are used for building web applications.

The most important language, for a modern looking web application, is JavaScript. You can get around most of it if you use some another-language-to-JavaScript translator like GWT or pyjamas. The problem with JavaScript is described perfectly in this quote from GWT:
"Writing dynamic web applications today is a tedious and error-prone process; you spend 90% of your time working around subtle incompatibilities between web browsers and platforms, and JavaScript's lack of modularity makes sharing, testing, and reusing AJAX components difficult and fragile."
Unfortunately, if you need some special JavaScript trick, you really have to understand the language and the browser quirks that go along with it. Using one of the many AJAX libraries can help reduce the common problems.

For the server part, we can use many languages and frameworks. The most important factor is, again, easy-to-use, since we still would like to concentrate on business problems instead of technical ones. The second factor is speed, though it's not as important as in a desktop application (network delays usually far surpass the server delay). More important than speed is scalability, but this is also dependent more on the application design than actual language, though some frameworks might constrain the design. Portability, size and reverse-engineering-potential are non-issues if you host the web application yourself, but if you intend to distribute it as a product, they will be as important as for a desktop application (well, size might not matter much in this case).

.Net/C#/ASP.NET is one nice platform, with clear separation between code and HTML, though the resulting HTML and JavaScript are not very nice. You can also use a nice AJAX library, which is nicely integrated with the rest of ASP.NET and speeds up development considerably. This combination only fails on portability (maybe not, Mono might help) and reverse-engineering.

Java is quite similar to .Net, with a lot more frameworks to chose from (Struts, Spring, JSF, plain old JSP etc.). Also note that GWT is designed to work with Java, but of course you can use any AJAX library. Portability is included by design, which is also nice.

PHP is the Visual Basic of the web world, and I say this in the sense that everybody knows it (except me), and everybody uses it, and the ugliest web code is written in it. Well, maybe except for Perl. Anyway, it has all the advantages (and disadvantages) of the Java and .Net worlds, with tons of libraries available.

Python is one of the nicest platform for web development, with a lot of frameworks to mix and match to suit your needs: Zope, Django, TurboGears etc. It also has all the advantages of Java and .Net, but with a much nicer language underneath.

Ruby and Ruby on Rails. If you like less libraries than Python, less choice and a Perl-ish language, Ruby does the trick.

Perl can be successfully used to write web applications and has the nice CPAN libraries to help. That's if you can get used to decipher line noise, because that's how the source looks like when you first see it. Of course, you can write line noise in any language, but in Perl it's the norm rather than a weird contest.

2 comments:

Duncan Bayne said...

How many of the web development languages & frameworks have you actually tried yourself? Anyone can write flippant put-downs. It's much harder to offer constructive criticism ... or even detailed criticism.

For instance, you're pretty quick to dismiss Ruby on Rails ... what about it in particular didn't you like? What did you like? What about either the language (Ruby) or the framework (Rails) would have to change in order for you to rate it more highly?

Costin said...

Nothing particularly wrong with Ruby on Rails, just with Ruby. It is heavily influenced by Perl, which I don't particularly like (as you can clearly see).

Rails is just another framework (that I admit I only spent about two hours with it), and it's copycat (IMHO), TurboGears, is based on a much nicer language (Python). If you can live with the indentation-as-block-delimiter, which I can, but I agree it might not fit everybody. ;-)