Web development with Java

Now that’s a large topic. A very, very large topic. In case you are into Java web development, you are going to have to decide between millions of frameworks for similar tasks, and sometimes for the simplest and most obvious thing to do, you’ll have to introduce a whole framework into your project. The learning curve for all these frameworks is also another problem. You start with GWT, and realise that it does not feel right always. There are times when it is nice to have Java code compiled into JavaScript, but there are times when it does not feel right. So you want a more server side approach, and that’s where things start to get crazy.

You have struts (old, but still used), JSP, JSF (on top of JSP), Facelets (because JSF on top of JSP is problematic), JSF 2.0 (soon), GWT, Tapestry etc… You have specs and application servers, web containers with their soap opera relationships with specs. J2EE 1.4 or J2EE 5? Tomcat or JBoss, if so which version? Java 5 or 6?

By the way, why not think about different implementations of the same standard? MyFaces or Sun’s reference implementation of JSF? Oh, I forgot to mention, J2EE 5 makes application servers provide their own implementation, so you may need to figure out how to replace defaults with your library.

While you think about this, endless libraries and frameworks  are born and an equal amount of them is dying. It is like the universe with stars and planets. Only for Ajax in JSF you have at least four options, some of them being relatives of others. GWT, Ajax4JSF, RichFaces, GWT4JSF….

And what about the glue type of frameworks? Spring and/or Seam for your web application would be nice, don’t you think so?

I am just trying to come up with a set of reliable and productive tools and technologies, and for Java and web based development, I do not feel like I’m winning. Seriously, things are getting out of control in this domain. The problem is I am in a position where I have to build a set of tools that will support web based development, but in such a fragmented domain, how can I target the combination with largest set of users? I don’t know, I really do not know.

Tired of inconsistent methods for quality assurance

I am not sure if quality assurance is the right term for what I’m trying to describe. As soon as you start something a little bit larger than the proof of concept project, you realise that something is wrong. The way you (I) handle potential errors is problematic in a couple of ways:

Code that ensures that certain conditions are satisfied in your classes is cluttering your class methods. These are secondary concerns in terms of what your class is supposed to do, and having to read code that ensures that constraints on method parameters are satisfied is not nice.

The defensive code is not written in the same way all the time, you do not focus on consistency of this code as much as you do for other parts of the code, or at least that is what I intend to do. This leads to a feeling of guilt, since I know that that aspect of my code is not as good as it should have been.

There are options to handle this problem in a consistent way, and JML is one of them. The reason I got interested in JML is that openEHR has significant parts of it implemented in Eiffel, and Eiffel has quite interesting features for providing what I’m looking for and more. Design By Contract is the paradigm which is supported by Eiffel in a strong and convenient way. JML looks promising, you can find papers, more than one implementation, Eclipse plugins etc… Unfortunately, I am bounded by some requirements like java 5 (generics is nice) and Eclipse (almost de facto now). Apparently none of the existing projects support this combination fully, and this is not good news.

I’ll be taking a look at AOP next, but I have to say I would have been much happier if java5 was supported by JML tools.