MVC Pattern

The Model-View-Control (MVC) is a software architecture that should allow a front-end and a back-end developer to work on the same system without interrupting other files. The three core components of MVC are: Model(component that interact with the database), View(the User interface and the presentation), and Controller(handling the interaction between View and Model and controlling the flow).

Model

The Model is the bridge between the View component and the Controller component. The Model is actually technically blind which means that the model has no knowledge of what happens to the data when it is passed to the View or Controller components. The Model component is the pyramid of the whole system without which there isn’t a connection between the Controller and the View.

View

The View is where data, requested from the Model, is viewed and its final output is determined. The View is the part of the system where the HTML is generated and displayed. The View interact with the Controller, but the View part is never given data by the Controller , as there is no direct relationship between the View and the Controller without the Model in between them

Controller

The final component of the pattern is the Controller. Its job is to control data that the user inputs and update the Model accordingly. The Controller’s life is the user and the Controller has no purpose without user interactions. It is the only part of the pattern with which user should interact. The Controller does not contain any logic other than that needed to collect the input.                                                               

To correctly apply the MVC architecture, there must be no interaction between models and views: all the logic is handled by controllers.”

About the Author

Prerna

Prerna

Related Posts

X