Skip to main content

The ABC's of MVC

Posted by larryjava on May 21, 2012 at 9:24 AM PDT

When we starting planning how we were going to use Java technology at Amway (10 years ago);
we realized we had many decisions to make about standards to adopt, practices to learn,
architectures to use, patterns to follow, etc.
Fortunately for us, there were many sources of information to help us figure all of this out.
Unfortunately for us, there were many sources of information to help us figure all of this out.

For example, we wanted to follow the MVC (Model - View - Controller) design pattern for a
major portion of the application that we were creating.

So when we consulted our sources about the meaning of MVC, we got a variety of answers.
When we asked the question, "What is MVC in terms of Java components?"

Here are some of the answers we got:

model = plain java object
view = jsp
controller = servlet

model = servlet
view = jsp
controller = servlet

model = plain java object
view = servlet & jsp
controller = plain java object

model = ejb
view = servlet
controller = ejb

We thought we would get a simple consistent answer. We did not.
So after some thought, we decided to use this interpretation for MVC:

model = ejb
view = jsp
controller = servlet

With the MVC matter settled, we learned a valuable lesson.
When using Java technology, there will be a variety of ways to use it.
You have to choose what is right for you based on a variety of factors.
What is right for you may not be right for someone else.
Maybe you decide to follow what others have done.
Maybe you decide to invent something unique. At Amway, we did both.

So 10 years later, how are things going with MVC at Amway?

We are still using,

model = ejb
view = jsp
controller = servlet

as our interpretation of MVC.

I'd say we made the right choice!

Comments

I'd say you have a really stubborn architect!

I'd say you have a really stubborn architect!