Let’s hear it for the Groovlets

I am a big fan of Groovlets, the Groovy wrapper around servlets. Although it is theoretically possible to do this with any scripting language Groovlets are definitely the easiest to get working and the most powerful to use quickly, in my experience, as unlike Jython and Jruby you don’t have to deal with the original languages packaging system to get access to templating and data access.

I’ve created a little wiki (and it is quite small currently) to record my experiences of using Groovlets and to provide a few examples that I felt were lacking in the official pages. If you haven’t already seen it you may also want to have a look at my Gant wiki too.

Web Applications, Work

The death of MVC

The MVC pattern is so embedded into the concept of modern web development I feel quite the heretic for declaring it over. Yet more and more I think we are moving away from it as a pattern. Views have been boiled down to a special case of templating and now Controllers are the next under the microscope. What does a Controller do? Well it marshalls the model and exposes it to the view.

However with the relentless march of REST how much controlling is the Controller really doing? The HTTP request tells you the format of the data, identifies the resource it is interested in. How much need is there for a controller for each request type? Surely the Uber Controller that responds to the HTTP request is all that’s required.

I have also been using Groovlets recently and when using them I feel like “why not mix your model lookup with the ‘view'”. In my Groovlets I essentially lookup the data for the view either directly via Groovy SQL or via the Service layer that is injected out of Guice. The view is then created using Markup Builder.

Since my scripts end up at around 50 lines of code I think that any benefit I might have in separating things is outweighed by the fact that the entire interaction is in one place and can be found, read and changed very easily.

MVC saved us from really painful web architectures but as we grow more sophisticated in the way we handle HTTP Requests and the more we understand the implications of HTTP and the less ceremonial our languages becomes the less benefit we get from it.