A lot of Web frameworks actually practices a software architecture model called MVC that divides the software into three parts:
- The Model object is packed with information and business logically, such as the operations repository
- The View represents the user interface, showing and editing the form, which can embed the HTML of the Ruby program.
- Controller is responsible for sending the information to the model, the HTTP Request from the outside (ie, the browser), and the model interaction with the output View(i.e. HTML)
The following steps in this illustration are:
- Browser out HTTP request please
- Controller Operation Model Information
- Model Access information repository
- The Controller feeds The resulting information to the View panel
- Return the final HTML product to the browser
Through the MVC pattern, we can have the system code and separate the business logically and user interface, so that the front end and the backend developers can work independently, and the code has a consistent structure, the file location is clear, these examples of the Web The framework helps you to think about it. With the code, it's easier to protect.
What is MVC