MVC Recap 1. Strong separation between presentation (controllers and views) and domain (model) 2. Divide UI widgets into controller (input handling) and view (state representation) 3. View and controller observe model to allow multiple widgets to update without direct communication
ADR Dispatcher Action Responder Domain 1. Web handler receives request and dispatches to an action 2. Action interacts with domain 3. Action feeds data to responder 4. Responder builds response using the data fed by action 5. Web handler sends response to client
MVC class
BlogController
extends
Controller
{
public
function
create()
{
if
($this-‐>request-‐>isPost())
{
$data
=
$this-‐>request-‐>getPost(‘blog’);
$blog
=
new
BlogModel($data);
ADR class
BlogCreateAction
extends
Action
{
public
function
__invoke()
{
if
($this-‐>request-‐>isPost())
{
$data
=
$this-‐>request-‐>getPost(‘blog’);
$blog
=
new
BlogModel($data);