| 1. |
What is the MVC pattern? |
|
Answer» The Model-View-Controller (MVC) is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. It’s different to note that this pattern is unrelated to the layered pattern we saw earlier. MVC pattern operates on the software side, while the layered pattern DICTATES how and where we place our DATABASE and application servers. In an application that follows the MVC pattern, each COMPONENT has its role well specified. For example, model classes only hold the data and the BUSINESS logic. They don't deal with HTTP requests. Views only display information. The controllers handle and respond to user input and decide which model to pass to which view. This is known as the SEPARATION of responsibility. It makes an application easy to develop and maintain over time as it grows in complexity. Though Model-View-Controller is one of the oldest and most prominent patterns, alternate patterns have emerged over the years. Some popular patterns include MVVM (Model-View-ViewModel), MVP (Model-View-Presenter), MVA (Model-View-Adapter). |
|