The Modified MVC Design Pattern
The Power of the View Model
In Object Oriented Programming (OOP) we learn that Encapsulation, as the first pillar of OOP, gives us Data Hiding in our designs. This decouples the architecture and helps us comply with the Open/Closed Principle.
By abstracting away the details of action methods we enable the higher level modules to concentrate on their Single Responsibilities.
The Modern Developer’s MVC Showcase design pattern splits the Model, in MVC pattern, into separate responsibilities: The View Models and the Models.
The Models hold State Data and the View Models perform the Business Logic Actions that creates the Razor View’s strongly typed Model DTO.
The Two Tasks in the Modern Developer’s MVC Showcase Design Pattern:
-
Behavior Tasks – Methods that perform actions requested by the Controller
-
State Tasks – Model DTOs that move Data and Information as View Request DTOs and View Response DTO Models.
The View Models and the Models within the MVC Model design block allows us to encapsulate the Behavior and State responsibilities as decoupled Software Entities.
This design pattern modification helps us to comply with another design principle: The Behavior Versus State Principle.
Wisdom Pearl #123- Organize Your Creations
A Place for Everything … And Everything in its Place
… Organize Your Creations By Their Behaviors and Responsibilities
The following two tabs change content below.
I am a Principal Architect at Liquid Hub in the Philadelphia area specializing in Agile Practices as a Certified Scrum Master (CSM). I use Test Driven Development (TDD) and Acceptance Test Driven Development (ATDD) with Behavior Driven Development (BDD) as my bridge to Agile User Stories Acceptance Criteria in a Domain Driven Design (DDD) implementing true RESTful services
Latest posts by Brad Huett (see all)
- DevOps: A Bridge to Your DevOps Culture - March 25, 2016
- Embracing Test Driven Development (TDD) - March 25, 2016
- DevOps: Delivering Agile Projects - March 25, 2016