Professional Documents
Culture Documents
3 Clean Architecture Patterns Practices Principles m3 Slides
3 Clean Architecture Patterns Practices Principles m3 Slides
Matthew Renze
SOFTWARE CONSULTANT
@matthewrenze www.matthewrenze.com
Overview Application Layer
Dependency Inversion Principle
Pros and Cons
Demo
What Are Layers?
Levels of abstraction
Single-responsibility
Isolate roles and skills
Multiple implementations
Varying rates of change
Classic Three-layer Architecture
Users
User Interface
Business Logic
Data Access
Database
Dependency
Modern Four-layer Architecture
Users
Presentation
Cross-Cutting Concerns
Application
Domain
Persistence Infrastructure
Database OS
Dependency
Application Layer
Users
Implements use cases
Presentation
Cross-Cutting Concerns
High-level application logic
Application
Knows about the domain
Domain
No knowledge of other layers
Persistence Infrastructure
Contains interfaces
Database OS
Dependency
Layer Dependencies
Users
Cross-Cutting Concerns
Inversion of control Application
Database OS
Presentation
SalesController
Cross-cutting concerns
Application
ICreateSaleCommand
IDateService
DateService
CreateSaleCommand
IDatabaseService IInventoryService
Domain
Sale
Persistence Infrastructure
DatabaseService InventoryService
Composition
Implements
Database OS
Why Use an Application Layer
Users
Pros Presentation
Cross-Cutting Concerns
Focus on use cases Application
Database OS
Why Use an Application Layer
Pros Cons
Focus on use cases Additional layer cost
Easy to understand Requires extra thought
Follows DIP IoC is counter-intuitive
Set Up
Show Application Project
Show SalesController Class
Show ICreateSaleCommand Interface
Show Create Sale Model
Show CreateSaleCommand Class (Part 1)
Show CreateSaleCommand Class (Part 2)
Show IDatabaseService Interface
Show DatabaseService Class
Other Dependencies
Wrap Up
Summary Application Layer
Dependency Inversion Principle
Pros and Cons
Demo