Practical options for building Web 2.0 applications

by Dafydd Rees

Image of hands on a laptopThe backlash against large, complex web development tools has been building up for a number of years. In the last year or so we've seen substantial adoption of more concise web development frameworks written by small groups of open source developers. These frameworks promise to be simpler for developers to use and require less code be written. This article explains this new direction in web development and why it matters.


The Problem with J2EE and .Net

The most popular approaches taken by big companies to web development have centered around Sun's Java 2 Enterprise Edition (J2EE) platform and Microsoft's .Net platform. A large market has emerged selling corporate development tools and professional services to both camps.

Unfortunately both the J2EE and the .Net approach often involve many layers of code, infrastruc-ture and complex configuration. For example a developer building a web application using J2EE might start a web project deciding which existing frameworks to use to handle these concerns:

Just choosing and configuring the minimal number of layers needed for the first release of a project could take a few days time! Although the situation is a little better for Microsoft developers there are many "alternative" frameworks in the Microsoft world that developers can choose to simplify or customise different aspects of their work.

It's no longer the case that a developer can say "I'm a Java developer". Now we have an industry in which people are interested in whether you're a "Java developer that uses Spring MVC and Hibernate" or a "Java developer that uses webwork and toplink". This leads to a lot of politics and ridiculous levels of specialisation.

Web applications often have large numbers of configuration files tying each layer together, and it's often the case that the same concept is described in three or four different places in the same application. For example there might be a customer database table, a customer mapping file describing how to turn a row in the database into an object in memory. In many cases, the developer ends up describing the fact that "a customer has a name and an email address" in three different places. This often makes for a verbose, bloated codebase in which developers are constantly wading through verbose definitions, worrying about consistency rather than describing the unique, new behaviour that warranted writing the application in the first place.

There are a number of popular explanations for this state of affairs:


What users now expect from your site

Nowadays websites are expected to be far more interactive. In particular, the last few years have seen adoption of a number of technologies, each of which creates extra work and complexity for the web developer:


Web Frameworks Based on Dynamic Languages

The most promising of the new web frameworks are written using dynamic languages. By this we mean languages that don't require a noticable, separate compilation stage so you can just type in expressions and see them evaluated.

The three best known of these new frameworks is "Ruby on Rails", "Django" and "Turbogears". The "Ruby on Rails" framework is written in Ruby whereas "Django" and "Turbogears" are both written in Python.

It's worth considering what these frameworks have in common:

Ruby on Rails is the best-known of the three frameworks and has seen enormous growth in the last two years. This is clear from the explosion in the number of Ruby and Ruby on Rails books, courses and conferences. Rails has extensive support for test-driven development, separating out unit, functional and integration tests. It should be noted though that Rails developers often test their applications differently from Java and C# developers. "Unit testing" in Rails almost always means testing individual "model" classes, and "functional testing" almost always means testing a "controller". It's worth mentioning that Rails, like many ruby applications tends to build objects use them briefly and discard them. Programmers used to Java and Smalltalk will find this disconcerting and can it make Rails difficult to trace.

The biggest decision here is between Rails, the market leader and either of the Python-based alter-natives. Ruby has few high-profile uses beyond Rails whereas there are many well-known Python projects. If you already know Python it's tempting to try Django or Turbogears. A year or so ago, there were noticable differences between the Django and Turbogears feature-sets, although now they are fairly equal. Some people recommend Django over Rails for applications that are are close to being a straight "content management system". Perhaps this isn't surprising since Django evolved in a media environment.

There's still lots of good money to be made writing C# and Java applications although these new frameworks illustrate that there far faster and simpler approaches than the standard Java or .Net way to build a web application. In this article we just considered three of the better known frameworks.




Links:
Ruby on Rails: www.rubyonrails.org
The TurboGears framework: www.turbogears.org
Django: www.djangoproject.com
Sean Kelly, "Better Web Application Development", video.google.com/videoplay?docid=6297126166376226181. A good demonstration of the problems of J2EE and how frameworks based on dynamic languages can help. (Note that the feature sets mentioned for Django and Turbogears are out of date.)



About the author:
Dafydd Rees is a software developer specialising in object-technology and agile methods. He welcomes feedback on this article at www.dafydd.net/feedback.php



Send a comment about this article to editor@itwales.com.



Menu: Home, Services, Events, Features, Interviews, Profiles, Reviews, News, Resources, Press