J2EE

Archived Posts from this Category

The MVC (Model-View-Controller)

Posted by Aurelio Pascual on 08 Jan 2007 | Tagged as: J2EE

The second installment in our series on Design Patterns is the most popular ofall patterns, the MVC. MVC stands for Model-View-Controller. That means your application is separated into these three components. Let us discuss these components one by one.

  • Model – a model is a representation of your business logic and/or data. For example, if you have an online shopping application, your shopping cart, items, and the codes that update your cart are the models.
  • Controller – takes user input and decides what to do with the model.
  • View – the one responsible for the presentation of the state of the model.

One good analogy for the MVC is a car. The model is the car engine. The brakes, steering wheel and other controls represent the controller. The tachometerand the thermometer are the views.

Continue Reading »