Monday, August 25, 2008

Model-3 Architecture?

What is the difference between Model-2 and Model-3 architectures? This is the question one of my colleague faced in is job interview. Never before I came across Model-3 architecture, so I googled for it. Soon I realized there is nothing official about Model-3 but I could find two references to it. One is a blog and other one is a mail-archive related to a project in sourceforge.

After studying these links I felt like any framework/application using JSF and EJB 3.0 is a Model-3 app. Let me explain why…
As per one of the links the below are the main properties of Model-3 architecture.

1. An improved event model.
2. A new scope that encourages efficient memory usage.
3. Standardized create, read, update, and write support between model and controller.
4. Supports cooperation and interaction between multiple MVC components ( portlets ).

Let’s take the Seam framework which uses JSF and EJB 3.0 and analyze about requirements. As we know JSF is a component based framework with support for different events and listeners like ActionListeners, ValueChangeListeners etc. So the first requirement is fulfilled. Seam introduces a context called Conversation context which is between Session and Request, which is the 2nd point. In 3rd point Author talks about simplified CRUD operations and easy linking of UI and persistence layer. This is in a way achieved with EJB 3.0’s entities which follow JPA.

Based on the above discussion can we conclude MVC with added events and JPA type persistence is Model-3?

No comments: