1. three stages of software structure development: Model1, Model2, MVC, and Model1. The most important feature of Model1 is that there is no concept of hierarchy, that is to say, process the interface and business logic in one file. disadvantages: 1. the presentation layer and business logic layer are mixed together, which is very messy. 2. in the actual development process, it is not conducive to collaborative development by multiple people.
1. three phases of software structure development:
Model1, Model2, and MVC
1> The most important feature of Model1 is that there is no hierarchical concept, that is, the interface
And business logic processing in a file to complete.
Disadvantages: 1. the presentation layer and business logic layer are mixed together, which is messy.
2 in the actual development process, it is not conducive to collaborative development by many people.
3 is not conducive to later maintenance
Advantages: 1. simple and fast development
2. suitable for small projects
2> Model2 layered mode: write the interface and business logic separately. the advantage is that the structure is clear and beneficial
Division of Labor Development. some books refer to this hierarchical mode as the MV mode,
That is, M --> Model (business logic layer), V --> View (interface layer)
In development, how do I change the program in Model1 mode to Model2:
1. PHP is used at the interface layer, and business logic classes (business operations are encapsulated in classes)
2. encapsulate common code (such as database operations) into classes.
3> MVC mode: the controller is added in the layered mode.
It forcibly separates application input, processing, and output. MVC applications are divided
Three core components: Model M, View V, controller C
M is mainly used by classes to process specific business logic.
V is mainly used as the interface to display data.
C is used to respond to various user requests.
2. why MVC:
We found that in Model2 mode, the interface not only acts as the display function,
It also processes various requests (such as deleting a piece of data on the current interface), but as the project continues to expand, there will be a lot of requests on the interface, if all are written in
The code is messy. that is to say, it is not good to directly send a request to the interface layer for processing, so the MVC mode is generated.