File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Why MVC? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Why MVC?" Watch "Why MVC?" New topic

Why MVC?

Ranch Hand

Joined: Oct 30, 2000
Posts: 94
In my company we are having a very interesting discussion. Its mostly centered around why MVC?
The application is extremely dynamic. The end user can change fields and layouts. He can define his own fields. The application itself will have several such setups running parallely. Thus depending on a users setting Form A will have 10 fields but another user belonging to other organization can have 8 or 10 fields on the same Form.It has a very flexible and extensive privileges system.
The first approach suggested is to keep all the logic in database. The database holds information about page layouts,about security privileges,report layouts and so on. All the processing logic is in stored procedures. All pages come from database.JSP/Beans only execute calls to database.
The second approach is of using a more object oriented approach ..maybe going for MVC architecture maybe using struts etc.
The present perception with first approach is that it will be highly customizable and will require considerably less development effort
I would like to know what will be the pros and cons of both approaches based on various points like reusability,performance,scalability and so on. The application would be sold as a "product". So it will be enhanced frequently.
Please give me inputs on what approach should be taken. Why do people put such a heavy emphasis on MVC?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

MVC is itself an object-oriented approach. By keeping the display stuff separated from the data stuff gluing them together with a controller it's easier to keep code portable, reusable and maintainable.
Although in JSP we tend to think of MVC only at the page level, in Smalltalk, where the term first gained parlance, it was not uncommon to do MVC at the control group or individual control level as well. Some implementations called this Model/Pane/Dispatcher.
Thus, your database could be contain a toolbox where you select a model, a view, and a controller and store their relationship and this would give you the best of both approaches.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Why MVC?
jQuery in Action, 3rd edition