17 Jul 2013
July 17, 2013

MVC – The truth – 1

0 Comment

Here I start a series of articles on MVC architecture and its implementation within vtiger5.4 and 6.

Here is the first one…

————————————————————————————————————————

Essentially, when it must have been implemented around 1979 or so, the MVC (which is still stands for – Model View Controller) tried to bridge the gap between the human’s mental model of the information and the digital model of the computer. MVC supports the user’s illusion that he is seeing and manipulating the information directly in the computer while actually it is not so. This is especially more useful when there are more users and each user wants to see the same information in different contexts and from different views just like how this figure represents.

MVC characteristics are undoubtedly abstract but it seems very common and logical and undeniably incredible.

MVC1

Model – A Model represents information or data or knowledge.  A model could be a single data element, a table within a database or an entire database in itself.

View – A View is a visual representation of the Model. It acts as some kind of a presentation filter where certain attributes of a Model are hidden and some are not. The View asks questions to the model and presents only the answers of those questions. These questions and answers will have to be understood by the model only. Hence the View should understand the semantics of the data it represents

Controller – Controller links the data/model and the user. What information should be represented where on the screen with which Views and in which form is determined by the Controller. The Controller helps the user by arrangement of menus and commands to access the data/ The Controller also translates the user commands to the appropriate views and helps generate the output correctly.

A simple analogy would be

Model ————————View——————————Controller

(HTML)————————(CSS)——————————(Browser)

or

In an application development scenario it could be

Model ————————View——————————Controller

(Data classes)—————(HTML)———————-(Application logic)

The simplicity of MVC is beautiful indeed!!

Leave a Reply

Your email address will not be published. Required fields are marked *