No more MVC
Tags: mvc, webdev, designpatterns, architecture
Published: 2018-01-14 19:01:46

---
title: No more MVC
published: true
description: 
tags: mvc, webdev, designpatterns, architecture
cover_image: https://thepracticaldev.s3.amazonaws.com/i/ntcbaj922shcuyfolukk.png
---
#What's wrong with MVC?
Model-View-Controller or [MVC](https://en.wikipedia.org/wiki/Model–view–controller) 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](https://www.google.cz/search?client=safari&rls=en&dcr=0&biw=1440&bih=839&tbm=isch&sa=1&ei=p5FbWoa0Kou00gXgga-YDg&q=mvc+diagram&oq=mvc+diagram&gs_l=psy-ab.3..0j0i30k1l3j0i5i30k1l5j0i8i30k1.457354.459660.0.459819.15.14.0.0.0.0.149.1488.8j6.14.0....0...1c.1.64.psy-ab..5.10.1005...0i19k1j0i30i19k1j0i8i30i19k1.0.6XAv3kLRibU)), many similar/different successors like [MVP](https://en.wikipedia.org/wiki/Model–view–presenter) or [MVVM](https://en.wikipedia.org/wiki/Model–view–viewmodel). However it does not describe well how (**server-side!**) web-app architecture looks like. That's why [pmjones](https://github.com/pmjones) comes with refinement of the term MVC for web purposes.


#Action-Domain-Responder

![Action-Domain-Responder diagram](http://pmjones.io/adr/adr.png)

Action-Domain-Responder or [ADR](http://pmjones.io/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

* [ADR description](https://github.com/pmjones/adr) by it's author [pmjones](https://github.com/pmjones)
* [Talk (video)](https://vimeo.com/106771285) by [pmjones](https://github.com/pmjones)