Jdon article: the MVC mode is dead

Source: Internet
Author: User

MVC mode: The model view attempts to control the controller. It is currently the mainstream mode. It is learned and mastered as the basic mode for getting started with server software. The mainstream framework struts 1/2 JSF wicket basically supports the MVC mode.

However, over time, the MVC pattern also exposes many shortcomings, because the MVC pattern is essentially a structural pattern, which is actually static and relatively fixed compared with the behavior pattern, with the popularity of B/S and Internet applications, the popularity of Web 2.0, social media, games, and other frequently-used interactive applications, the relatively static MVC model is no longer suitable for highly interactive behavior-oriented applications.

Ddd Domain Modeling itself attaches great importance to structure. Its object Value Object and server are also a structure division, but it does not emphasize the importance of Object Responsibility and behavior, which is the only difference between objects and databases, of course, the introduction of the context scenario concept can also reflect the importance attached to roles and scenarios, but it is far from enough.

On the contrary, the book "Object Design: roles, responsibilities, and collaborations" (Object Design: roles, responsibilities, and) proposes responsibility-Driven Development to focus on object behavior, it is pointed out that an object is actually playing a role, and the role is responsible. Then, some interactive behaviors will be implemented in the context of a certain scenario. These have been fully discussed in jdon:
DCI, domain model, and domain event ideas
Asynchronous architecture thinking: Using akka for Domain Modeling

This book summarizes the four major disadvantages of centralized controller. The MVC controller actually belongs to this centralized controller style:

1. control logic can get overly complex. the Controller will become complicated. Many people write business code in the struts action controller. All the operations are in the action, and some actions are almost thousands of lines.

2. controllers can become dependent on information holders 'contents. the Controller has become dependent on the information data center or database. The controller does many things, which means that the domain object will do very little. The controller will not only do anything but decide strategic things, it is 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 through the action of the controller. An object is obtained through a query in the Controller and then copied to another object. These two objects are coupled together.

4. the only interesting work is done in the controller. the only interesting task is to act as a controller. Responsibilities's responsibilities are sucked into the Controller object, leaving only some actions to the role model for completion, and all important things are concentrated in the controller.

The Controller of MVC is a mediator mode and also a centralized controller. The major difference between it and the observer mode is that the mediator mode encapsulates communication, while the observer distributes communication. From the communication point of view, the Controller also has its inherent defects and is easy to become a large and fully-coupled concentrator.OoNot allowed.

DCI architecture is a new concept that has just emerged recently. It looks at software from a new perspective, which coincides with the responsibility-driven design.DddDevelopment and improvement.

DCI is short for the context interaction interactions of data Data scenarios. its important contribution is to propose the concept of scenario, which is not mentioned in the book of responsibility-driven development. This book only denies MVC, no alternative solution was proposed to expose the problem.DCIIt is the alternative architecture of MVC, and DCI should replace the controller with the scenario, for exampleDCIArchitecture: a new vision of object-oriented programming ):

In fact, the control and model in MVC are dug out and combined in the role scenario. This is a new angle that is completely different from that of the MVC model.Oo.

Recently, it has been suggested that context is a new object type. A scenario can replace not only the Web Service of SOA, but also the controller of MVC.

I personally think that the new layered architecture may become like this in the future:
View --> context ---> domain model ---> component/respository

The MVC mode is dead.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.