This article tries to demonstrate that Java can be more productive than Ruby. We are going to develop the same application of the article Rolling with Ruby on Rails Revisited (part 1 and part 2) but using POJOs annotated with JPA and a Model Driven Framework, OpenXava in this case. The result is that with less code, and less time you obtain a more powerful application.
Ruby and rails: The regressive framework
Ruby on rails is so elegant, so easy, so productive. I cannot avoid read and heard continuously these comments. For example, the article Rolling with Ruby on Rails Revisited of Bill Walton says:
“What would you think if I told you that you can develop a web application at least ten times faster with Rails than you can with a typical Java framework?”
Oops! Ten times faster!
Well, after these comments I decided to learn Ruby on Rails. I need to know the true key of the productivity and programmer happiness.
After have a taste of RnR I found it a very classic framework, with old techniques:
MVC: I'm looking for something newer and better that an old MVC framework.
The Java problem: Java developers
The productivity in Java world is a cultural problem, not a technical one. That is this is not a Java fault, it's our fault, we, the Java developers, need to design very beautiful architectures, to apply everywhere the GoF patterns, to do everything reusable, to put 3 tiers in all our systems and to use web services for all. We are not looking for simplicity, therefore we have not found it. But, Java is a very elegant language that allows simpler approach to software development.
Java productivity: The other way
A way for productivity is to use a Model Driven approach. That is, develop the model part, and only the model part, of our application, and to use a framework to produce all the application from it. MDA, OpenXava, Trails, NakedObjects, RomaFramework and JMatter are examples of this approach.
This is the main screen of the wanted application:
Basically, the app's supposed to do three things:
Display a list of all recipes.
Create new recipes and edit existing recipes.
Assign a recipe to a category (like "dessert" or "soup").