SlideShare a Scribd company logo
1 of 42
Download to read offline
Action-Domain-Responder
A Web-Specific Refinement of Model-View-Controller
@pmjones
http://pmjones.github.io/adr
Read These
About Me
• 8 years USAF Intelligence
• BASIC in 1983, PHP since 1999
• Jr. Developer,VP Engineering
• Aura project, Zend_DB, Zend_View
• ZCE Advisory Board
• PHP-FIG: PSR-1, PSR-2, PSR-4
• MLAPHP (http://mlaphp.com)
Overview
• How we think of MVC versus its desktop origins
• How ADR refines “MVC” for the web
• How ADR relates to existing “MVC” alternatives
• Address ADR comments and questions
“You Keep UsingThat Word …”
Server-Side MVC
• From all concerns combined (ball of mud) …
• … to separation of concerns (data source, business logic, presentation)
• Oriented around HTTP (stateless shared-nothing request/response)
• Google for “mvc in (php | python | rails)”
• General consensus on components, not so much on collaborations
Server-Side MVC Collaborations
• User Agent sends a Request
• Router/Dispatcher invokes Controller
• Controller manages flow, invokes Model(s) that encapsulate domain
• Controller assigns values toView template
• Controller invokesView and sets into Response (with headers)
“… I Do NotThink It Means
WhatYouThink It Means.”
Smalltalk-80 MVC
• Desktop graphical UI pattern
• Separation of concerns (input
management, internal representation of
domain, presentation to user)
• Interactive event-driven desktop
(keyboard/mouse, in-memory)
• Google for “smalltalk mvc”
Smalltalk-80 MVC Collaborations
• Controller receives keyboard/mouse input
events from User
• Controller notifiesView and Model,
respectively
• View and Model notify each other for updates
• View updates are rendered on the screen
• Hierarchical collection of interrelated MVC
triads for each screen element (event system)
The Pit Web Of Despair
HowTo Describe Web UI Patterns?
• Model 1: Sun JSP for page scripting (ball of mud)
• Model 2 : Servlet for action (Controller) and JSP for template (View)
The Names AreThe Same,
ButThe Game Has Changed
• Used the name MVC for Model 2
• Subverted the collaborations
• From event-driven to request/response (pages)
• No more messaging interactions between triads
• One collected set of interactions delivered
AreTheseThe Same?
“Dear God,What IsThatThing?”
• The pattern name “Model-View-Controller” has several meanings
• Hard to determine exactly what collaborations to expect
• Smalltalk-80 MVC relates more closely to client-side
• Model 2 MVC relates more closely to server-side
• Even more semantic diffusion since 2000:
• https://www.google.com/search?q=mvc+diagram
You’reTryingTo Kidnap

What I’ve Rightfully Stolen
Toward A Web-Specific UI Pattern
• Stop using in-memory desktop GUI patterns as server patterns
• Entirely new name to break the association with “MVC”
• Remember we are in a client/server (request/response) environment
• Use existing server-side “MVC” as a basis
• Refine the components and collaborations toward better practices
Refining the “Model” to “Domain”
• The “Domain” has essentially identical responsibilities
• Reminiscent of “Domain Logic”:TransactionScript, DomainModel,
TableModule, ServiceLayer
• Reminiscent of “Domain Driven Design”: Repository
• (ActiveRecord is categorized as a “Data Source” pattern)
• Usually think of aView system as templates (screen elements)
• Client receives HTTP response of both body and headers
• This means theView in server-based MVC is not the template
• TheView in server-based MVC is the Response
Refining the “View” to “Responder”
Intermingled Presentation Logic
• TemplateViews generally build HTTP body values
• Remaining Controller logic manipulates HTTP header values
• Presentation logic is mixed betweenViews and Controllers
• Need a layer that is completely in charge of building the Response
“Responder” For Presentation
• Responder layer handles setting headers, status, etc
• Additionally uses templates for setting body content
• Invoke a Responder for presentation of Response
Using Responders In Controllers
• Remove Response presentation from all Controller action methods
• index(), create(), read(), update(), delete()
• Each action method has its own set of status codes and templates
One Responder Per Controller?
• One Responder per Controller to cover all possible action methods?
• No: inject one Responder per action method
• But: injecting Responders that might not be needed
Refining the “Controller” To “Action”
• Instead of a Controller with index(), create(), read(), etc. …
• … one class per Action: IndexAction, CreateAction, ReadAction, etc.
• Inject the individual Responder into the individual Action
“Let me explain.
No, there is too much.
Let me sum up.”
Components
• Domain is the logic to manipulate the domain, session, application, and
environment data, modifying state and persistence as needed.
• Responder is the logic to build an HTTP response or response description. It
deals with body content, templates and views, headers and cookies, status codes,
and so on.
• Action is the logic that connects the Domain and Responder. It uses the request
input to interact with the Domain, and passes the Domain output to the Responder.
Collaborations
• Action feeds input from HTTP
request to a Domain layer
• Action feeds output from
Domain layer to a Responder
• Responder builds the HTTP
response headers and body
Model View
Controller
Action
ResponderDomain
Code Examples
AboutThe Examples
• Overly-simplified to highlight components and collaborations
• Action is minimalist, almost trivial (micro-framework-ish)
• Domain becomes much more robust
• Responder has to determine presentation based on Domain values
“I’m NotThe Real Dread Pirate Roberts.”
Is ADR Just Another Pattern In A Mask?
• EBI

(Entity-Boundary-Interactor)
• DCI

(Data-Context-Interaction)
• MVP

(Model-View-Presenter)
• MVVM

(Model-View-ViewModel)
• PAC

(Presentation-Abstraction-Control)
• RMR

(Resource-Method-Representation)
Entity-Boundary-Interactor
At best,ADR maps only roughly to EBI:
- the ADR Action and Responder elements may represent a web-
specific EBI Boundary
- the ADR Domain element may represent an EBI Interactor
element, encapsulating or otherwise hiding the EBI Entity
elements from the ADR Action.
Alternatively, in ports-and-adapters or hexagonal architecture
terms, it may be reasonable to think of the Action as a "port"
through which an EBI Boundary is invoked as part of the ADR
Domain. Finally, the Responder could be seen as an "adapter"
back through which the application data is returned.
Data-Context-Interaction
DCI is described as a complement to MVC, not a replacement for
MVC. I think it is fair to call it a complement to ADR as well.
Model-View-Presenter
(Supervising Controller, PassiveView)
- Model and the Domain map closely, as they do in MVC.
- Passive View does not map well to either Action or Responder; it might
better be regarded as the response that gets returned to the client.
- Supervising Controller might map to Responder, in that it "manipulate[s] the
view to handle more complex view logic". However, Responder is not
responsible for interacting with the Domain, and it does not receive the client
input, so does not seem to be a good fit for Supervising Controller.
- Alternatively, Supervising Controller might map to Action, but the Action is not
responsible for manipulating the view (i.e. the response).
Model-View-ViewModel
Maps only incompletely to ADR.
- The Model in MVVM maps closely to the Model in MVC and the Domain
in ADR.
- Similarly, the View in MVVM maps closely to the View in MVC and the
Responder in ADR.
- However, the ViewModel does not map well to a Controller in MVC or an
Action in ADR.
Presentation-Abstraction-Control
PAC is used as a hierarchical structure of agents, each consisting of a triad of
presentation, abstraction and control parts.
The agents (or triads) communicate with each other only through the control
part of each triad.
It completely insulates the presentation (view in MVC) and the abstraction
(model in MVC).
This provides the option to separately multithread the model and view which
can give the user experience of very short program start times, as the user
interface (presentation) can be shown before the abstraction has fully
initialized.
Resource-Method-Representation
Resource <--> Domain
Method <--> Action
Representation <--> Responder
“A Resource can be thought of as an object with private variables and public methods that
correspond to HTTP methods. From an MVC point of view, a resource can be thought of as a
model with a bit of controller thrown in." -- Mixing of concerns.
"The Representation is like a view in MVC, we give it a resource object and tell it to serialize
the data into it's output format." -- No allowance for other HTTP responses.
ADR might be considered an expanded or superset variation of RMR, one where a Resource
and an action one can perform on it are cleanly separated into a Domain and an Action, and
where the Representation (i.e., the building of the response) is handled by a Responder.
“I Would Not Say SuchThings If I WereYou!”
Criticisms
• Isn’t that a lot of classes?
• Where does “feature” go in ADR?
• Can I use it with “language” ?
• Can I use it on the client?
• Omission of Request
• Omission of Front Controller
• The examples are too limiting
• You’re forgetting “pattern”
“You’d Make A Wonderful Dread Pirate Roberts.”
Conclusion
• MVC originated for in-memory desktop user interfaces
• Did not translate to the web so well
• Explored ADR as a way to refine MVC specifically for the web
• Code, commentary, and criticism around ADR
Thanks!
• http://pmjones.github.io/adr (ADR Paper)
• http://mlaphp.com/ (Modernizing Legacy Apps in PHP)
• http://paul-m-jones.com/ and @pmjones

More Related Content

What's hot

Baby steps to Domain-Driven Design
Baby steps to Domain-Driven DesignBaby steps to Domain-Driven Design
Baby steps to Domain-Driven DesignŽilvinas Kuusas
 
Create rest service in osb 12c over database table
Create rest service in osb 12c over database tableCreate rest service in osb 12c over database table
Create rest service in osb 12c over database tablecoolaboration
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design QuicklyMariam Hakobyan
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery FundamentalsGil Fink
 
Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript FundamentalsSunny Sharma
 
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
FYBSC IT Web Programming Unit V  Advanced PHP and MySQLFYBSC IT Web Programming Unit V  Advanced PHP and MySQL
FYBSC IT Web Programming Unit V Advanced PHP and MySQLArti Parab Academics
 
Jesus was slapped in the face
Jesus was slapped in the faceJesus was slapped in the face
Jesus was slapped in the faceGLENN PEASE
 
Logistic Regression using Mahout
Logistic Regression using MahoutLogistic Regression using Mahout
Logistic Regression using Mahouttanuvir
 
Relational algebra-and-relational-calculus
Relational algebra-and-relational-calculusRelational algebra-and-relational-calculus
Relational algebra-and-relational-calculusSalman Vadsarya
 
Asynchronous programming in C#
Asynchronous programming in C#Asynchronous programming in C#
Asynchronous programming in C#Bohdan Pashkovskyi
 
Packages,interfaces and exceptions
Packages,interfaces and exceptionsPackages,interfaces and exceptions
Packages,interfaces and exceptionsMavoori Soshmitha
 

What's hot (20)

Baby steps to Domain-Driven Design
Baby steps to Domain-Driven DesignBaby steps to Domain-Driven Design
Baby steps to Domain-Driven Design
 
Create rest service in osb 12c over database table
Create rest service in osb 12c over database tableCreate rest service in osb 12c over database table
Create rest service in osb 12c over database table
 
ReactJS presentation.pptx
ReactJS presentation.pptxReactJS presentation.pptx
ReactJS presentation.pptx
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design Quickly
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript Fundamentals
 
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
FYBSC IT Web Programming Unit V  Advanced PHP and MySQLFYBSC IT Web Programming Unit V  Advanced PHP and MySQL
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
 
Jesus was slapped in the face
Jesus was slapped in the faceJesus was slapped in the face
Jesus was slapped in the face
 
XML
XMLXML
XML
 
Logistic Regression using Mahout
Logistic Regression using MahoutLogistic Regression using Mahout
Logistic Regression using Mahout
 
Relational algebra-and-relational-calculus
Relational algebra-and-relational-calculusRelational algebra-and-relational-calculus
Relational algebra-and-relational-calculus
 
Asynchronous programming in C#
Asynchronous programming in C#Asynchronous programming in C#
Asynchronous programming in C#
 
Packages,interfaces and exceptions
Packages,interfaces and exceptionsPackages,interfaces and exceptions
Packages,interfaces and exceptions
 
OOP and FP
OOP and FPOOP and FP
OOP and FP
 
Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
 
SFDC Batch Apex
SFDC Batch ApexSFDC Batch Apex
SFDC Batch Apex
 
Ngrx: Redux in angular
Ngrx: Redux in angularNgrx: Redux in angular
Ngrx: Redux in angular
 
Javascript
JavascriptJavascript
Javascript
 
Apuntes: Manejar el DOM con JavaScript
Apuntes: Manejar el DOM con JavaScriptApuntes: Manejar el DOM con JavaScript
Apuntes: Manejar el DOM con JavaScript
 
01 Php Introduction
01 Php Introduction01 Php Introduction
01 Php Introduction
 

Viewers also liked

Action-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-ControllerAction-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-ControllerPaul Jones
 
Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)Paul Jones
 
How Do We Get The Deficit To Zero?
How Do We Get The Deficit To Zero?How Do We Get The Deficit To Zero?
How Do We Get The Deficit To Zero?Paul Jones
 
Same Thing Happens Every Time
Same Thing Happens Every TimeSame Thing Happens Every Time
Same Thing Happens Every TimePaul Jones
 
The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)Paul Jones
 
All You Jokers
All You JokersAll You Jokers
All You JokersPaul Jones
 
Framework and Application Benchmarking
Framework and Application BenchmarkingFramework and Application Benchmarking
Framework and Application BenchmarkingPaul Jones
 
Decoupled Libraries for PHP
Decoupled Libraries for PHPDecoupled Libraries for PHP
Decoupled Libraries for PHPPaul Jones
 
How To Train Your Manager
How To Train Your ManagerHow To Train Your Manager
How To Train Your ManagerPaul Jones
 
MVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,MobileMVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,Mobilenaral
 
Career and Life Management
Career and Life ManagementCareer and Life Management
Career and Life ManagementPaul Jones
 
Smalltalk In a Nutshell
Smalltalk In a NutshellSmalltalk In a Nutshell
Smalltalk In a NutshellMichele Lanza
 

Viewers also liked (14)

Action-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-ControllerAction-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
 
Web Development with Smalltalk
Web Development with SmalltalkWeb Development with Smalltalk
Web Development with Smalltalk
 
Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)
 
How Do We Get The Deficit To Zero?
How Do We Get The Deficit To Zero?How Do We Get The Deficit To Zero?
How Do We Get The Deficit To Zero?
 
Same Thing Happens Every Time
Same Thing Happens Every TimeSame Thing Happens Every Time
Same Thing Happens Every Time
 
The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)
 
All You Jokers
All You JokersAll You Jokers
All You Jokers
 
Framework and Application Benchmarking
Framework and Application BenchmarkingFramework and Application Benchmarking
Framework and Application Benchmarking
 
Decoupled Libraries for PHP
Decoupled Libraries for PHPDecoupled Libraries for PHP
Decoupled Libraries for PHP
 
How To Train Your Manager
How To Train Your ManagerHow To Train Your Manager
How To Train Your Manager
 
MVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,MobileMVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,Mobile
 
Career and Life Management
Career and Life ManagementCareer and Life Management
Career and Life Management
 
Smalltalk In a Nutshell
Smalltalk In a NutshellSmalltalk In a Nutshell
Smalltalk In a Nutshell
 
JavaCro'14 - Vaadin web application integration for Enterprise systems – Pete...
JavaCro'14 - Vaadin web application integration for Enterprise systems – Pete...JavaCro'14 - Vaadin web application integration for Enterprise systems – Pete...
JavaCro'14 - Vaadin web application integration for Enterprise systems – Pete...
 

Similar to Action-Domain-Responder: A Refinement of MVC

Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesQamar Abbas
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Railscodeinmotion
 
RubyConf Bangladesh 2017 - Rails buggy code
RubyConf Bangladesh 2017 - Rails buggy codeRubyConf Bangladesh 2017 - Rails buggy code
RubyConf Bangladesh 2017 - Rails buggy codeRuby Bangladesh
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017Innovation Studio
 
React gsg presentation with ryan jung &amp; elias malik
React   gsg presentation with ryan jung &amp; elias malikReact   gsg presentation with ryan jung &amp; elias malik
React gsg presentation with ryan jung &amp; elias malikLama K Banna
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9AHM Pervej Kabir
 
Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introductionFajar Baskoro
 
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)Daniel Bryant
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Thomas Robbins
 
Crafted Design - ITAKE 2014
Crafted Design - ITAKE 2014Crafted Design - ITAKE 2014
Crafted Design - ITAKE 2014Sandro Mancuso
 
Advanced web application architecture Way2Web
Advanced web application architecture Way2WebAdvanced web application architecture Way2Web
Advanced web application architecture Way2WebMatthias Noback
 
What is ASP.NET MVC
What is ASP.NET MVCWhat is ASP.NET MVC
What is ASP.NET MVCBrad Oyler
 
Crafted Design - Sandro Mancuso
Crafted Design - Sandro MancusoCrafted Design - Sandro Mancuso
Crafted Design - Sandro MancusoJAXLondon2014
 
Introduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training classIntroduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training classQUONTRASOLUTIONS
 
Onion Architecture with S#arp
Onion Architecture with S#arpOnion Architecture with S#arp
Onion Architecture with S#arpGary Pedretti
 
Spring MVC framework features and concepts
Spring MVC framework features and conceptsSpring MVC framework features and concepts
Spring MVC framework features and conceptsAsmaShaikh478737
 

Similar to Action-Domain-Responder: A Refinement of MVC (20)

Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelines
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
 
RubyConf Bangladesh 2017 - Rails buggy code
RubyConf Bangladesh 2017 - Rails buggy codeRubyConf Bangladesh 2017 - Rails buggy code
RubyConf Bangladesh 2017 - Rails buggy code
 
Mvc
MvcMvc
Mvc
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017
 
React gsg presentation with ryan jung &amp; elias malik
React   gsg presentation with ryan jung &amp; elias malikReact   gsg presentation with ryan jung &amp; elias malik
React gsg presentation with ryan jung &amp; elias malik
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
 
Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
 
J2EE pattern 5
J2EE pattern 5J2EE pattern 5
J2EE pattern 5
 
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 
Crafted Design - ITAKE 2014
Crafted Design - ITAKE 2014Crafted Design - ITAKE 2014
Crafted Design - ITAKE 2014
 
Advanced web application architecture Way2Web
Advanced web application architecture Way2WebAdvanced web application architecture Way2Web
Advanced web application architecture Way2Web
 
What is ASP.NET MVC
What is ASP.NET MVCWhat is ASP.NET MVC
What is ASP.NET MVC
 
Crafted Design - Sandro Mancuso
Crafted Design - Sandro MancusoCrafted Design - Sandro Mancuso
Crafted Design - Sandro Mancuso
 
Introduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training classIntroduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training class
 
Onion Architecture with S#arp
Onion Architecture with S#arpOnion Architecture with S#arp
Onion Architecture with S#arp
 
Spring MVC framework features and concepts
Spring MVC framework features and conceptsSpring MVC framework features and concepts
Spring MVC framework features and concepts
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 

Recently uploaded

VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...tanu pandey
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...singhpriety023
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663Call Girls Mumbai
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 

Action-Domain-Responder: A Refinement of MVC

  • 1. Action-Domain-Responder A Web-Specific Refinement of Model-View-Controller @pmjones http://pmjones.github.io/adr
  • 3. About Me • 8 years USAF Intelligence • BASIC in 1983, PHP since 1999 • Jr. Developer,VP Engineering • Aura project, Zend_DB, Zend_View • ZCE Advisory Board • PHP-FIG: PSR-1, PSR-2, PSR-4 • MLAPHP (http://mlaphp.com)
  • 4. Overview • How we think of MVC versus its desktop origins • How ADR refines “MVC” for the web • How ADR relates to existing “MVC” alternatives • Address ADR comments and questions
  • 5. “You Keep UsingThat Word …”
  • 6. Server-Side MVC • From all concerns combined (ball of mud) … • … to separation of concerns (data source, business logic, presentation) • Oriented around HTTP (stateless shared-nothing request/response) • Google for “mvc in (php | python | rails)” • General consensus on components, not so much on collaborations
  • 7. Server-Side MVC Collaborations • User Agent sends a Request • Router/Dispatcher invokes Controller • Controller manages flow, invokes Model(s) that encapsulate domain • Controller assigns values toView template • Controller invokesView and sets into Response (with headers)
  • 8. “… I Do NotThink It Means WhatYouThink It Means.”
  • 9. Smalltalk-80 MVC • Desktop graphical UI pattern • Separation of concerns (input management, internal representation of domain, presentation to user) • Interactive event-driven desktop (keyboard/mouse, in-memory) • Google for “smalltalk mvc”
  • 10. Smalltalk-80 MVC Collaborations • Controller receives keyboard/mouse input events from User • Controller notifiesView and Model, respectively • View and Model notify each other for updates • View updates are rendered on the screen • Hierarchical collection of interrelated MVC triads for each screen element (event system)
  • 11. The Pit Web Of Despair
  • 12. HowTo Describe Web UI Patterns? • Model 1: Sun JSP for page scripting (ball of mud) • Model 2 : Servlet for action (Controller) and JSP for template (View)
  • 13. The Names AreThe Same, ButThe Game Has Changed • Used the name MVC for Model 2 • Subverted the collaborations • From event-driven to request/response (pages) • No more messaging interactions between triads • One collected set of interactions delivered
  • 15. “Dear God,What IsThatThing?” • The pattern name “Model-View-Controller” has several meanings • Hard to determine exactly what collaborations to expect • Smalltalk-80 MVC relates more closely to client-side • Model 2 MVC relates more closely to server-side • Even more semantic diffusion since 2000: • https://www.google.com/search?q=mvc+diagram
  • 17. Toward A Web-Specific UI Pattern • Stop using in-memory desktop GUI patterns as server patterns • Entirely new name to break the association with “MVC” • Remember we are in a client/server (request/response) environment • Use existing server-side “MVC” as a basis • Refine the components and collaborations toward better practices
  • 18. Refining the “Model” to “Domain” • The “Domain” has essentially identical responsibilities • Reminiscent of “Domain Logic”:TransactionScript, DomainModel, TableModule, ServiceLayer • Reminiscent of “Domain Driven Design”: Repository • (ActiveRecord is categorized as a “Data Source” pattern)
  • 19. • Usually think of aView system as templates (screen elements) • Client receives HTTP response of both body and headers • This means theView in server-based MVC is not the template • TheView in server-based MVC is the Response Refining the “View” to “Responder”
  • 20. Intermingled Presentation Logic • TemplateViews generally build HTTP body values • Remaining Controller logic manipulates HTTP header values • Presentation logic is mixed betweenViews and Controllers • Need a layer that is completely in charge of building the Response
  • 21. “Responder” For Presentation • Responder layer handles setting headers, status, etc • Additionally uses templates for setting body content • Invoke a Responder for presentation of Response
  • 22. Using Responders In Controllers • Remove Response presentation from all Controller action methods • index(), create(), read(), update(), delete() • Each action method has its own set of status codes and templates
  • 23. One Responder Per Controller? • One Responder per Controller to cover all possible action methods? • No: inject one Responder per action method • But: injecting Responders that might not be needed
  • 24. Refining the “Controller” To “Action” • Instead of a Controller with index(), create(), read(), etc. … • … one class per Action: IndexAction, CreateAction, ReadAction, etc. • Inject the individual Responder into the individual Action
  • 25. “Let me explain. No, there is too much. Let me sum up.”
  • 26. Components • Domain is the logic to manipulate the domain, session, application, and environment data, modifying state and persistence as needed. • Responder is the logic to build an HTTP response or response description. It deals with body content, templates and views, headers and cookies, status codes, and so on. • Action is the logic that connects the Domain and Responder. It uses the request input to interact with the Domain, and passes the Domain output to the Responder.
  • 27. Collaborations • Action feeds input from HTTP request to a Domain layer • Action feeds output from Domain layer to a Responder • Responder builds the HTTP response headers and body Model View Controller Action ResponderDomain
  • 29. AboutThe Examples • Overly-simplified to highlight components and collaborations • Action is minimalist, almost trivial (micro-framework-ish) • Domain becomes much more robust • Responder has to determine presentation based on Domain values
  • 30. “I’m NotThe Real Dread Pirate Roberts.”
  • 31. Is ADR Just Another Pattern In A Mask? • EBI
 (Entity-Boundary-Interactor) • DCI
 (Data-Context-Interaction) • MVP
 (Model-View-Presenter) • MVVM
 (Model-View-ViewModel) • PAC
 (Presentation-Abstraction-Control) • RMR
 (Resource-Method-Representation)
  • 32. Entity-Boundary-Interactor At best,ADR maps only roughly to EBI: - the ADR Action and Responder elements may represent a web- specific EBI Boundary - the ADR Domain element may represent an EBI Interactor element, encapsulating or otherwise hiding the EBI Entity elements from the ADR Action. Alternatively, in ports-and-adapters or hexagonal architecture terms, it may be reasonable to think of the Action as a "port" through which an EBI Boundary is invoked as part of the ADR Domain. Finally, the Responder could be seen as an "adapter" back through which the application data is returned.
  • 33. Data-Context-Interaction DCI is described as a complement to MVC, not a replacement for MVC. I think it is fair to call it a complement to ADR as well.
  • 34. Model-View-Presenter (Supervising Controller, PassiveView) - Model and the Domain map closely, as they do in MVC. - Passive View does not map well to either Action or Responder; it might better be regarded as the response that gets returned to the client. - Supervising Controller might map to Responder, in that it "manipulate[s] the view to handle more complex view logic". However, Responder is not responsible for interacting with the Domain, and it does not receive the client input, so does not seem to be a good fit for Supervising Controller. - Alternatively, Supervising Controller might map to Action, but the Action is not responsible for manipulating the view (i.e. the response).
  • 35. Model-View-ViewModel Maps only incompletely to ADR. - The Model in MVVM maps closely to the Model in MVC and the Domain in ADR. - Similarly, the View in MVVM maps closely to the View in MVC and the Responder in ADR. - However, the ViewModel does not map well to a Controller in MVC or an Action in ADR.
  • 36. Presentation-Abstraction-Control PAC is used as a hierarchical structure of agents, each consisting of a triad of presentation, abstraction and control parts. The agents (or triads) communicate with each other only through the control part of each triad. It completely insulates the presentation (view in MVC) and the abstraction (model in MVC). This provides the option to separately multithread the model and view which can give the user experience of very short program start times, as the user interface (presentation) can be shown before the abstraction has fully initialized.
  • 37. Resource-Method-Representation Resource <--> Domain Method <--> Action Representation <--> Responder “A Resource can be thought of as an object with private variables and public methods that correspond to HTTP methods. From an MVC point of view, a resource can be thought of as a model with a bit of controller thrown in." -- Mixing of concerns. "The Representation is like a view in MVC, we give it a resource object and tell it to serialize the data into it's output format." -- No allowance for other HTTP responses. ADR might be considered an expanded or superset variation of RMR, one where a Resource and an action one can perform on it are cleanly separated into a Domain and an Action, and where the Representation (i.e., the building of the response) is handled by a Responder.
  • 38. “I Would Not Say SuchThings If I WereYou!”
  • 39. Criticisms • Isn’t that a lot of classes? • Where does “feature” go in ADR? • Can I use it with “language” ? • Can I use it on the client? • Omission of Request • Omission of Front Controller • The examples are too limiting • You’re forgetting “pattern”
  • 40. “You’d Make A Wonderful Dread Pirate Roberts.”
  • 41. Conclusion • MVC originated for in-memory desktop user interfaces • Did not translate to the web so well • Explored ADR as a way to refine MVC specifically for the web • Code, commentary, and criticism around ADR
  • 42. Thanks! • http://pmjones.github.io/adr (ADR Paper) • http://mlaphp.com/ (Modernizing Legacy Apps in PHP) • http://paul-m-jones.com/ and @pmjones