The MVC litany goes on

Today on Javablogs, another post with "MVC" in the title: Bashing MVC. The short entry seems relevant, until the last sentence: If MVC is really bad then why framework like struts are so famous?. Another loss, Struts is not about MVC. After 3 years of Struts and almost five years after the infamous Understanding JavaServer Pages Model 2 architecture - Exploring the MVC design pattern, it should be clear that Model2 has almost nothing to do with MVC. Model: the ActionForms, why not. Controller: the Struts Servlet, only one Controller for the application? In regular MVC you've got one Controller per widget! View: JSP? If it was MVC, the View would be in the client browser: HTML, JavaScript, Applet, Flash, whatever, but not the JSP themselves which are only procedures generating some flat files. And there is more in MVC than the "three components". Where is the "Model notifies the View" mechanism? Does Struts does something to update all the client screens when an ActionFom is updated? First you have to grab a handle on those ActionForms, which by default only live the time of the request processing. Where is the hierarchy of Views (and thus the hierarchy of Controllers) for handling the users inputs? This can last long.

Today, many of the young Java developers start doing web applications, and they are told that Struts is MVC. When they start doing some stuff with Swing, they are told it's easy, because Swing is MVC as well. And they fail to understand why there is no magic XML file with the navigational aspects, why there is nothing to magically call their 'execute' methods, why their Form are completely useless. They'll discover the wonders of notifications, and the richness of heavy clients. Eventually, they hopefully will have forgotten Struts, or they will realize that it's probably nothing more than the Command design pattern reachable through an HTTP request.

Update: Andy Wardley says it better here.

Comments

1. On Thursday 21 October 2004, 11:05 by Lunar

True MVC web development can be achived with framework like Echo : http://www.nextapp.com/products/echo/
But then, you have a web application, which is far from being a web site.

2. On Tuesday 26 October 2004, 12:06 by Florent

Still evangelizing people about why Struts can't be called an MVC :-)

3. On Tuesday 26 October 2004, 17:13 by Damien B

Always fighting for the truth ;-)