MVC Design Pattern

MVC Design Pattern Mahalo Studio Marbella

MVC Design Pattern

What is MVC pattern?

Model View Controller (MVC) is a design pattern used to decouple user-interface (view), data (model), and application logic (controller).

This pattern helps to achieve separation of concerns.Using the MVC pattern for websites, requests are routed to a Controller that is responsible for working with the Model to perform actions and/or retrieve data, the Controller chooses the View to display, and provides it with the Model and finally the View renders the final page, based on the data in the Model.

MVC is more of an architectural pattern, but not for complete application. MVC mostly relates to the UI / interaction layer of an application. You’re still going to need business logic layer, maybe some service layer and data access layer.

MVC Pattern Design

MVC Design Pattern
MVC Design Pattern
  • Models

    The central component of the pattern. It is the application’s dynamic data structure, independent of the user interface. It directly manages the data, logic and rules of the application. Models represent knowledge. A model could be a single object (rather uninteresting), or it could be some structure of objects. There should be a one-to-one correspondence between the model and its parts on the one hand, and the represented world as perceived by the owner of the model on the other hand.

  • Views

    A view is a (visual) representation of its model. It would ordinarily highlight certain attributes of the model and suppress others. It is thus acting as a presentation filter. Any representation of information such as a chart, diagram or table. Multiple views of the same information are possible, such as a bar chart for management and a tabular view for accountants. A view is attached to its model (or model part) and gets the data necessary for the presentation from the model by asking questions. It may also update the model by sending appropriate messages. All these questions and messages have to be in the terminology of the model, the view will therefore have to know the semantics of the attributes of the model it represents.

  • Controllers

    A controller is the link between a user and the system. It provides the user with input by arranging for relevant views to present themselves in appropriate places on the screen. It provides means for user output by presenting the user with menus or other means of giving commands and data. The controller receives such user output, translates it into the appropriate messages and pass these messages on to one or more of the views.

As with other software patterns, MVC expresses the “core of the solution” to a problem while allowing it to be adapted for each system. Particular MVC design pattern can vary significantly from the traditional description here.

 

Share:
Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on linkedin
LinkedIn

Leave a Reply

Latest posts
Subscribe To Our Monthly Newsletter
No spam, notifications only about new products, updates.
Related Posts

How to Clone a WordPress Site

How to Clone a WordPress Site? Sometimes you might need to clone your WordPress site. Maybe you want to use it as a template for