MVC mode: Model View tries to control the controller, which is the current mainstream mode, and is used as the basic mode of server software entry to learn and master, and the mainstream framework Struts 1/2 JSF Wicket basically supports MVC mode.
However, with the continuous popularization of B/S and Internet applications, Web 2.0 and a large number of frequent interactive applications such as social media and games, the relatively static MVC mode is no longer suitable for highly interactive and behavior-oriented applications.
DDD domain modeling itself pays more attention to structure, its entity value object and server is also a kind of structural division, but it does not emphasize the importance of object duties and behaviors, and this is the only difference between objects and databases.
On the contrary,Object Design: Roles, Responsibilities, and CollaborationsThe book proposes that the object is actually playing a certain role, and the role is responsible, and then a certain interactive behavior will be implemented in a certain scene context, which has been fully discussed in Jdon:
DCI, domain model, some ideas for domain events
Asynchronous Architectural Thinking: Implement domain modeling with Akka
The book summarizes the four major disadvantages of centralized controllers, and MVC's controllers actually belong to this centralized controller style:
1.Control logic can get overly complex. Controllers can get complicated, and it's common for many people to write business code in Struts' Action controllers.All actions are in actions, and some actions are almost thousands of lines.
2.Controllers can become dependent on information holders' contents. Controllers become dependent on information data centers or databases, controllers do a lot of things, which means that domain objects do very little, and the controller will not only do what in the end, but also decide strategic things, but also coupled with tactical issues such as how to do it and how to implement it.
3.Objects can become coupled indirectly through the actions of their controller. Objects are indirectly coupled together through the controller's actions, one object is queried in the controller, and then copied to another object, and the two objects are coupled together.
4.The only interesting work is done in the controller.
The controller of MVC is a kind of Mediator mode, but also a centralized controller, it is the main difference from the observer mode: the Mediator mode encapsulates communication, while the observer decentralized communication, from the communication point of view, the controller also has its inherent defects, easy to become a large and fully coupled concentrator, these are all forOOIt is not tolerated.
DCI architectureIt is a new concept that has only recently emerged and looks at software from a new perspective, which coincides with and is right about duty-driven designDDDdevelopment and improvement.
DCI is the abbreviation of Data Context Interactions, and its important contribution is to put forward the concept of scenes, which is not mentioned in the book Duty-Driven Development, which only denies MVC, exposes its problems, and does not propose alternativesDCIIt is the alternative architecture of MVC, and DCI replaces MVC with scenarios to replace controllers, as shown in the figure below (the picture is from).Original English TheDCI Architecture: A New Vision of Object-Oriented Programming):
The scene actually digs out some of the controls and models in MVC and reassembles them in the form of character scenes. This is a new angle that is completely different from the MVC mode consideration, which is more in line with this angleOO。
Recently, someone has raised itScene Context is a new object type, the scene can not only be replacedSOAWeb services can also replace MVC controllers.
Personally, I think that the new hierarchical architecture may look like this in the future: View --> Context ---> Domain Model ---> Component/Respository
MVC mode is dead.
|