Musings on web frameworks

It’s been a while since I last posted. Life can really get in the way of blogging 🙂

Having worked with Struts for a while now, I’m starting to agree with some of the criticisms. One of the most common tasks I need to perform is to set up an page with data before displaying it. What ends up happening is that two seperate Actions are required to manage one form. One to set it up, and the other to process a response. And then to make it more confusing, sometimes you need to skip the setup stage, as when viewing a form that was already submitted at an earlier stage. When you get a number of developers working on one system it become really hard to enforce a standard approach. Sure you can come up with all sorts of home-grown approaches for that sort of thing, but I really think that we should be past that stage now. I heard a great comment on frameworks concerning this – that a good framework should be restrictive enough to enforce structure and flexible enough to let you do what you need to. Sure Struts is pretty flexible, but I feel it’s certainly lacking in the structure department. I saw a proposal a while back for the next version, codenamed Shale at the time, that proposed a standard implementation of the two-stage page processing model. It sounded promising at the time but haven’t heard anything recently and the original proposal is nowhere to be found.

The other issue I have with Struts is its tight integration with the Servlet API. Unit testing becomes horribly convoluted when you have to set up session state, mock objects etc. StrutsTestCase helps with the details, but I just don’t think it’s unit testing per-se, it’s closer to functional testing. The WebWork framework looks like it is going in the right direction insofar as the Action-equivalent class deals only with variables set up by accessor methods. Unit testing can therefore be just that – a test of the functionality of the one class – especially if it’s designed to be integrated with a dependency injection framework.

I am not sure how WebWork handles my first issue, but it’s definitely worth investigating further. Struts has been an excellent starting point – it was like getting into a hot bath after having worked with ad-hoc JSPs/ASP – but I think it’s time to look at other stuff. I get the impression that it’s just not moving along anywhere near as fast as it should be.


Posted

in

by

Tags: