DEV Community

Cover image for No more MVC
Jakub N
Jakub N

Posted on

No more MVC

What's wrong with MVC?

Model-View-Controller or MVC is a software architectural pattern originally developed for desktop user interfaces in the 1970s. Through the years this architecture became very popular in web-development and MVC is even today, after almost 50 years, the way to go with many popular frameworks in different languages.

So what's wrong with Model-View-Controller?

MVC was originally a design pattern for desktop graphical user interfaces. It has many different interpretations (try Google for definition), many similar/different successors like MVP or MVVM. However it does not describe well how (server-side!) web-app architecture looks like. That's why pmjones comes with refinement of the term MVC for web purposes.

Action-Domain-Responder

Action-Domain-Responder diagram

Action-Domain-Responder or ADR is a rather refinement of the term MVC than a brand new architectural pattern. But this new terminology describes much better how we compose our web-applications.

Action (Controller)

Handles incoming request, interacts with the Domain and finally passes data (Domain output) to the Responder.

In traditional MVC the Controller usually contains multiple actions, but incoming requests are dispatched to these action methods, not to the controller itself. Thats why in ADR each Action is represented by individual class or closure.

There is no interaction with the templating system.

Domain (Model)

Business/domain logic, data manipulation etc. There's no big difference between MVC and ADR at this level. Responder might use Domain objects only for presentation purposes i.e. no modifications.

Responder (View)

Gathers Domain data from the Action. Builds entire HTTP response. Interacts with templating system, sets header and cookie data, status codes etc.

For each individual Action class/closure there is one Responder class/closure.


Again, ADR is not something brand new, but a refinement of the MVC definition for purposes of modern server-side web development. It describes better the interactions in such systems and might bring better separation of concerns than original MVC does.

Further reading

Top comments (3)

Collapse
 
atoko profile image
Pedro Cardona

The queen is dead. Long live the queen!

Collapse
 
blackcat_dev profile image
Sasha Blagojevic

There is a saying in my country "Same sh*t different package"

Collapse
 
entomy profile image
Patrick Kelly

If you can translate 1:1, it's the same thing with different terminology, which does more to lead to fragmentation of literature than to resolve anything.