Home > Article > Backend Development > MVC creates a class in the M layer, and the C layer new objects of the corresponding class, and then passes them to the V layer. The V layer uses the object to call the corresponding class method. Have you seen this pattern?
MVC, create a class in the M layer, create a new object of the corresponding class in the C layer, and then pass it to the V layer. The V layer uses the object to call the corresponding class method. Have you seen this pattern?
MVC, create a class in the M layer, create a new object of the corresponding class in the C layer, and then pass it to the V layer. The V layer uses the object to call the corresponding class method. Have you seen this pattern?
MVC generally has the upper M layer which is the data model, operation methods and so on. The C layer is responsible for calling things from the M layer and organizing data. V layer data final data. .
But! Each company has different coding habits and will not strictly adhere to this. Just like what you said. The data object is constructed in M, and the object is only instantiated in C, and the V layer is specifically called. I have seen similar coding styles in several Japanese companies, and it is also allowed. So it doesn’t matter~just write according to the unified rules.
I have also seen the mode where M only declares data, C operates the data, and V processes + outputs. The writing is also quite easy. The key depends on the company