What is MVC Architecture?

0
1

As software applications become more and more complex, and the number of developers increase, it becomes more and more important that the components of an application are split into modular chunks. This is exactly what MVC Architecture does for us. MVC stands for "model, view, controller."

Model

The model refers to the data of an application after it has been retrieved from a database. The model is typically made up of objects which is located in RAM memory.

View

The view refers to the presentation of the data on the screen. For web applications, the view is made up of objects that bypass on the server if the pages being generated are static, or they can actually reside on the client's machine via Javascript objects or other native data structures like Flash Actionscript objects if the application is an RIA (rich internet application).

Controller

The controller reiterates the request and response handler for the application. The controller is usually created with servlets.

How it all fits together

To fully understand how MVC architecture works, let's think about what happens when an HTTP request is made with a web application. When someone clicks on a link to go to a new webpage, a request is made to the server. The controller then decides what page the user needs to go to, and what data needs to be sent. The application queries the appropriate databases, and puts the resulting data into the model.

At this point, the model can be easily manipulated, sorted, and filtered, and used to create the view that the user will see when the page first loads. The HTML content can be generated with a JSP (if the application uses the Java platform) and sent back to the client machine as a response.

For an RIA application, the view can be re-generated with Javascript objects before the page loads so that the data on the screen can be manipulated. As the user begins to interact with the features on the page, the Javascript objects can easily be manipulated and different parts of the screen can be updated without making a request to the server, therefore making the application behaving as if it were a desktop application.

Source

Leave a Reply