SlideShare a Scribd company logo
1 of 34
Download to read offline
Clean Architecture
Jason Taylor
Join the Conversation #GOTOCph @JasonGtAu
Join the Conversation #GOTOCph @JasonGtAu
SSW Solution Architect
Jason Taylor
github.com/jasongt
youtube.com/jasongt
Join the Conversation #DotNetCoreSuperpowers @SSW_TV
jasongtau
codingflow.net
Visiting from Australia
.NET Developer Since 2002
Keep It Simple, Stupid!
Clean Architecture
Infrastructure Layer
Application Layer
Presentation Layer
Next Steps
Domain Layer
Agenda
Clean Architecture
Independent of frameworks
Testable
Independent of UI
Independent of database
Independent anything external
Join the Conversation #GOTOCph @JasonGtAu
Presentation
Infrastructure
Application
Domain
Northwind Traders Sample
Clean Architecture
ASP.NET Core 3.0
Entity Framework Core 3.0
ASP.NET Core Identity 3.0
Repo bit.ly/northwind-traders
Join the Conversation #GOTOCph @JasonGtAu
Clean Architecture Template
.NET Core Template Package
ASP.NET Core 3.0
Entity Framework Core 3.0
ASP.NET Core Identity 3.0
Repo bit.ly/ca-sln
Join the Conversation #GOTOCph @JasonGtAu
Domain contains enterprise-wide logic and types
Application contains business-logic and types
Infrastructure contains all external concerns
Presentation and Infrastructure depend only on Application
Infrastructure and Presentation components can be replaced
with minimal effort
Join the Conversation #GOTOCph @JasonGtAu
Key Points
Clean Architecture
Infrastructure Layer
Application Layer
Presentation Layer
Next Steps
Domain Layer
Agenda
Overview
Entities
Value Objects
Enumerations
Logic
Exceptions
Join the Conversation #GOTOCph @JasonGtAu
Presentation
Application
Infrastructure
Domain
Demo
Reviewing the Domain layer
Join the Conversation #GOTOCph @JasonGtAu
Avoid using data annotations
Use value objects where appropriate
Create custom domain exceptions
Initialise all collections & use private setters
Automatically track changes
Join the Conversation #GOTOCph @JasonGtAu
Key Points
Clean Architecture
Infrastructure Layer
Application Layer
Presentation Layer
Next Steps
Domain Layer
Agenda
Overview
Interfaces
Models
Logic
Commands / Queries
Validators
Exceptions
Join the Conversation #GOTOCph @JasonGtAu
Presentation
Application
Infrastructure
Domain
CQRS
Command Query Responsibility Segregation
Separate reads (queries) from writes (commands)
Can maximise performance, scalability, and simplicity
Easy to add new features, just add a new query or command
Easy to maintain, changes only affect one command or query
Join the Conversation #GOTOCph @JasonGtAu
CQRS + MediatR = ♥
Define commands and queries as requests
Application layer is just a series of request / response
objects
Ability to attach additional behaviour before and / or
after each request, e.g. logging, validation, caching,
authorisation and so on
Join the Conversation #GOTOCph @JasonGtAu
Demo
Reviewing the Application layer
Join the Conversation #GOTOCph @JasonGtAu
Using CQRS + MediatR simplifies your overall design
MediatR simplifies cross cutting concerns
Fluent Validation is useful for all validation scenarios
AutoMapper simplifies mapping and projections
Independent of infrastructure concerns
Join the Conversation #GOTOCph @JasonGtAu
Key Points
Clean Architecture
Infrastructure Layer
Application Layer
Presentation Layer
Next Steps
Domain Layer
Agenda
Overview
Persistence
Identity
File System
System Clock
API Clients
Join the Conversation #GOTOCph @JasonGtAu
Presentation
Application
Infrastructure
Domain
Unit of Work and Repository Patterns
Should we implement these patterns?
It isn’t always the best choice, because:
EF Core insulates your code from database changes
DbContext acts as a unit of work
DbSet acts as a repository
EF Core has features for unit testing without repositories
Join the Conversation #GOTOCph @JasonGtAu
What do the experts think?
Join the Conversation #GOTOCph @JasonGtAu
I’m over Repositories, and
definitely over abstracting your
data layer.
No, the repository/unit-of-work
pattern isn’t useful with EF
Core.
No, you don’t need a repository.
But there are many benefits
and you should consider it!
Demo
Reviewing the Infrastructure layer
Join the Conversation #GOTOCph @JasonGtAu
Independent of the database
Use Fluent API configuration over data annotations
Prefer conventions over configuration
Automatically apply all entity type configurations
No layers depend on Infrastructure layer, e.g.
Presentation layer
Join the Conversation #GOTOCph @JasonGtAu
Key Points
Clean Architecture
Infrastructure Layer
Application Layer
Presentation Layer
Next Steps
Domain Layer
Agenda
Overview
SPA – Angular, React, Vue
Web API
Razor Pages
MVC
Web Forms
Join the Conversation #GOTOCph @JasonGtAu
Presentation
Application
Infrastructure
Domain
Demo
Reviewing the Presentation layer
Join the Conversation #GOTOCph @JasonGtAu
Controllers should not contain any application logic
Create and consume well defined view models
Open API bridges the gap between the front end and
back end
NSwag automates generation of Open API
specification and clients
Join the Conversation #GOTOCph @JasonGtAu
Key Points
Clean Architecture
Infrastructure Layer
Application Layer
Presentation Layer
Next Steps
Domain Layer
Agenda
Using the Solution Template
Join the Conversation #GOTOCph @JasonGtAu
C:CodeCaTodo>dotnet new -i Clean.Architecture.Solution.Template
C:CodeCaTodo>dotnet new ca-sln
The template "Clean Architecture Solution" was created successfully.
C:CodeCaTodo>
Join the Conversation #GOTOCph @JasonGtAu
Join the Conversation #GOTOCph @JasonGtAu
Thank you!
info@ssw.com.au
www.ssw.com.au
Sydney | Melbourne | Brisbane
@jasongtau
bit.ly/ca-sln
bit.ly/northwind-traders

More Related Content

What's hot

Domain Driven Design (DDD)
Domain Driven Design (DDD)Domain Driven Design (DDD)
Domain Driven Design (DDD)Tom Kocjan
 
Domain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledDomain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledNicola Costantino
 
Applying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain ModelsApplying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain ModelsAlexander van Trijffel
 
Real Life Clean Architecture
Real Life Clean ArchitectureReal Life Clean Architecture
Real Life Clean ArchitectureMattia Battiston
 
Distributed Caching in Kubernetes with Hazelcast
Distributed Caching in Kubernetes with HazelcastDistributed Caching in Kubernetes with Hazelcast
Distributed Caching in Kubernetes with HazelcastMesut Celik
 
Requirement and Specification
Requirement and SpecificationRequirement and Specification
Requirement and Specificationsarojsaroza
 
Requirements Engineering Processes in Software Engineering SE6
Requirements Engineering Processes in Software Engineering SE6Requirements Engineering Processes in Software Engineering SE6
Requirements Engineering Processes in Software Engineering SE6koolkampus
 
Introducing Clean Architecture
Introducing Clean ArchitectureIntroducing Clean Architecture
Introducing Clean ArchitectureRoc Boronat
 
Backstage at CNCF Madison.pptx
Backstage at CNCF Madison.pptxBackstage at CNCF Madison.pptx
Backstage at CNCF Madison.pptxBrandenTimm1
 
A Pattern Language for Microservices
A Pattern Language for MicroservicesA Pattern Language for Microservices
A Pattern Language for MicroservicesChris Richardson
 
Microservice Architecture | Microservices Tutorial for Beginners | Microservi...
Microservice Architecture | Microservices Tutorial for Beginners | Microservi...Microservice Architecture | Microservices Tutorial for Beginners | Microservi...
Microservice Architecture | Microservices Tutorial for Beginners | Microservi...Edureka!
 
Hexagonal architecture with Spring Boot
Hexagonal architecture with Spring BootHexagonal architecture with Spring Boot
Hexagonal architecture with Spring BootMikalai Alimenkou
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to MicroservicesMahmoudZidan41
 
Design patterns for microservice architecture
Design patterns for microservice architectureDesign patterns for microservice architecture
Design patterns for microservice architectureThe Software House
 

What's hot (20)

Domain Driven Design (DDD)
Domain Driven Design (DDD)Domain Driven Design (DDD)
Domain Driven Design (DDD)
 
Event Storming and Saga
Event Storming and SagaEvent Storming and Saga
Event Storming and Saga
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
 
Microservice intro
Microservice introMicroservice intro
Microservice intro
 
Domain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledDomain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) Distilled
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Applying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain ModelsApplying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain Models
 
Real Life Clean Architecture
Real Life Clean ArchitectureReal Life Clean Architecture
Real Life Clean Architecture
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
 
Distributed Caching in Kubernetes with Hazelcast
Distributed Caching in Kubernetes with HazelcastDistributed Caching in Kubernetes with Hazelcast
Distributed Caching in Kubernetes with Hazelcast
 
Microservice architecture
Microservice architectureMicroservice architecture
Microservice architecture
 
Requirement and Specification
Requirement and SpecificationRequirement and Specification
Requirement and Specification
 
Requirements Engineering Processes in Software Engineering SE6
Requirements Engineering Processes in Software Engineering SE6Requirements Engineering Processes in Software Engineering SE6
Requirements Engineering Processes in Software Engineering SE6
 
Introducing Clean Architecture
Introducing Clean ArchitectureIntroducing Clean Architecture
Introducing Clean Architecture
 
Backstage at CNCF Madison.pptx
Backstage at CNCF Madison.pptxBackstage at CNCF Madison.pptx
Backstage at CNCF Madison.pptx
 
A Pattern Language for Microservices
A Pattern Language for MicroservicesA Pattern Language for Microservices
A Pattern Language for Microservices
 
Microservice Architecture | Microservices Tutorial for Beginners | Microservi...
Microservice Architecture | Microservices Tutorial for Beginners | Microservi...Microservice Architecture | Microservices Tutorial for Beginners | Microservi...
Microservice Architecture | Microservices Tutorial for Beginners | Microservi...
 
Hexagonal architecture with Spring Boot
Hexagonal architecture with Spring BootHexagonal architecture with Spring Boot
Hexagonal architecture with Spring Boot
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Design patterns for microservice architecture
Design patterns for microservice architectureDesign patterns for microservice architecture
Design patterns for microservice architecture
 

Similar to Clean Architecture By Jason Taylor

Building Enterprise Apps with ASP.NET Core 2.1
Building Enterprise Apps with ASP.NET Core 2.1Building Enterprise Apps with ASP.NET Core 2.1
Building Enterprise Apps with ASP.NET Core 2.1Jason Taylor
 
The fight for surviving in the IoT world
The fight for surviving in the IoT worldThe fight for surviving in the IoT world
The fight for surviving in the IoT worldRadu Vunvulea
 
The fight for surviving in the IoT world - Radu Vunvulea
The fight for surviving in the IoT world - Radu VunvuleaThe fight for surviving in the IoT world - Radu Vunvulea
The fight for surviving in the IoT world - Radu VunvuleaITCamp
 
One Engine Two Tools
One Engine Two ToolsOne Engine Two Tools
One Engine Two ToolsChris Eargle
 
The Magic Of Application Lifecycle Management In Vs Public
The Magic Of Application Lifecycle Management In Vs PublicThe Magic Of Application Lifecycle Management In Vs Public
The Magic Of Application Lifecycle Management In Vs PublicDavid Solivan
 
Developing an Enterprise Architecture Capability
Developing an Enterprise Architecture CapabilityDeveloping an Enterprise Architecture Capability
Developing an Enterprise Architecture CapabilityAnthony Draffin
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan
 
Soprex framework on .net in action
Soprex framework on .net in actionSoprex framework on .net in action
Soprex framework on .net in actionMilan Vukoje
 
ITCamp 2013 - Florin Coros - Driving Your Team Towards Code Quality
ITCamp 2013 - Florin Coros - Driving Your Team Towards Code QualityITCamp 2013 - Florin Coros - Driving Your Team Towards Code Quality
ITCamp 2013 - Florin Coros - Driving Your Team Towards Code QualityITCamp
 
When the field isn't green: Introducing Model Based Systems Engineering into ...
When the field isn't green: Introducing Model Based Systems Engineering into ...When the field isn't green: Introducing Model Based Systems Engineering into ...
When the field isn't green: Introducing Model Based Systems Engineering into ...Jeffrey Cohen, P.E.
 
Ncrafts.io - Refactor your software architecture
Ncrafts.io - Refactor your software architectureNcrafts.io - Refactor your software architecture
Ncrafts.io - Refactor your software architectureJulien Lavigne du Cadet
 
01-01-2017 This section will lay out the implementation plan o.docx
01-01-2017 This section will lay out the implementation plan o.docx01-01-2017 This section will lay out the implementation plan o.docx
01-01-2017 This section will lay out the implementation plan o.docxhoney725342
 
GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...
GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...
GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...James Anderson
 
Elements of DDD with ASP.NET MVC & Entity Framework Code First v2
Elements of DDD with ASP.NET MVC & Entity Framework Code First v2Elements of DDD with ASP.NET MVC & Entity Framework Code First v2
Elements of DDD with ASP.NET MVC & Entity Framework Code First v2Enea Gabriel
 
Is BDD Worth It? Considerations for Advanced Test Automation
Is BDD Worth It? Considerations for Advanced Test AutomationIs BDD Worth It? Considerations for Advanced Test Automation
Is BDD Worth It? Considerations for Advanced Test AutomationPerfecto by Perforce
 
Enabling high level application development for internet of things
Enabling high level application development for internet of thingsEnabling high level application development for internet of things
Enabling high level application development for internet of thingsPankesh Patel
 
Project onion - Project Architecture for .Net Core Application
Project onion - Project Architecture for .Net Core ApplicationProject onion - Project Architecture for .Net Core Application
Project onion - Project Architecture for .Net Core ApplicationAbhinav Jha
 

Similar to Clean Architecture By Jason Taylor (20)

Building Enterprise Apps with ASP.NET Core 2.1
Building Enterprise Apps with ASP.NET Core 2.1Building Enterprise Apps with ASP.NET Core 2.1
Building Enterprise Apps with ASP.NET Core 2.1
 
The fight for surviving in the IoT world
The fight for surviving in the IoT worldThe fight for surviving in the IoT world
The fight for surviving in the IoT world
 
The fight for surviving in the IoT world - Radu Vunvulea
The fight for surviving in the IoT world - Radu VunvuleaThe fight for surviving in the IoT world - Radu Vunvulea
The fight for surviving in the IoT world - Radu Vunvulea
 
One Engine Two Tools
One Engine Two ToolsOne Engine Two Tools
One Engine Two Tools
 
The Magic Of Application Lifecycle Management In Vs Public
The Magic Of Application Lifecycle Management In Vs PublicThe Magic Of Application Lifecycle Management In Vs Public
The Magic Of Application Lifecycle Management In Vs Public
 
Developing an Enterprise Architecture Capability
Developing an Enterprise Architecture CapabilityDeveloping an Enterprise Architecture Capability
Developing an Enterprise Architecture Capability
 
EF Core (RC2)
EF Core (RC2)EF Core (RC2)
EF Core (RC2)
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2
 
Soprex framework on .net in action
Soprex framework on .net in actionSoprex framework on .net in action
Soprex framework on .net in action
 
ITCamp 2013 - Florin Coros - Driving Your Team Towards Code Quality
ITCamp 2013 - Florin Coros - Driving Your Team Towards Code QualityITCamp 2013 - Florin Coros - Driving Your Team Towards Code Quality
ITCamp 2013 - Florin Coros - Driving Your Team Towards Code Quality
 
When the field isn't green: Introducing Model Based Systems Engineering into ...
When the field isn't green: Introducing Model Based Systems Engineering into ...When the field isn't green: Introducing Model Based Systems Engineering into ...
When the field isn't green: Introducing Model Based Systems Engineering into ...
 
Game Studio
Game StudioGame Studio
Game Studio
 
Application Generation
Application GenerationApplication Generation
Application Generation
 
Ncrafts.io - Refactor your software architecture
Ncrafts.io - Refactor your software architectureNcrafts.io - Refactor your software architecture
Ncrafts.io - Refactor your software architecture
 
01-01-2017 This section will lay out the implementation plan o.docx
01-01-2017 This section will lay out the implementation plan o.docx01-01-2017 This section will lay out the implementation plan o.docx
01-01-2017 This section will lay out the implementation plan o.docx
 
GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...
GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...
GDG Cloud Southlake 31: Santosh Chennuri and Festus Yeboah: Empowering Develo...
 
Elements of DDD with ASP.NET MVC & Entity Framework Code First v2
Elements of DDD with ASP.NET MVC & Entity Framework Code First v2Elements of DDD with ASP.NET MVC & Entity Framework Code First v2
Elements of DDD with ASP.NET MVC & Entity Framework Code First v2
 
Is BDD Worth It? Considerations for Advanced Test Automation
Is BDD Worth It? Considerations for Advanced Test AutomationIs BDD Worth It? Considerations for Advanced Test Automation
Is BDD Worth It? Considerations for Advanced Test Automation
 
Enabling high level application development for internet of things
Enabling high level application development for internet of thingsEnabling high level application development for internet of things
Enabling high level application development for internet of things
 
Project onion - Project Architecture for .Net Core Application
Project onion - Project Architecture for .Net Core ApplicationProject onion - Project Architecture for .Net Core Application
Project onion - Project Architecture for .Net Core Application
 

More from maa77

NHS Number Leaflet
NHS Number LeafletNHS Number Leaflet
NHS Number Leafletmaa77
 
a data driven game object system
a data driven game object systema data driven game object system
a data driven game object systemmaa77
 
tww317-catalyst9100-powerpointslides-190801165911.pdf
tww317-catalyst9100-powerpointslides-190801165911.pdftww317-catalyst9100-powerpointslides-190801165911.pdf
tww317-catalyst9100-powerpointslides-190801165911.pdfmaa77
 
jt2019-jt--a26b6c1.pdf
jt2019-jt--a26b6c1.pdfjt2019-jt--a26b6c1.pdf
jt2019-jt--a26b6c1.pdfmaa77
 
ASPNET-in-Production.pptx
ASPNET-in-Production.pptxASPNET-in-Production.pptx
ASPNET-in-Production.pptxmaa77
 
2nd Report - Major Diagnostic Categories, 2014.pdf
2nd Report - Major Diagnostic Categories, 2014.pdf2nd Report - Major Diagnostic Categories, 2014.pdf
2nd Report - Major Diagnostic Categories, 2014.pdfmaa77
 

More from maa77 (6)

NHS Number Leaflet
NHS Number LeafletNHS Number Leaflet
NHS Number Leaflet
 
a data driven game object system
a data driven game object systema data driven game object system
a data driven game object system
 
tww317-catalyst9100-powerpointslides-190801165911.pdf
tww317-catalyst9100-powerpointslides-190801165911.pdftww317-catalyst9100-powerpointslides-190801165911.pdf
tww317-catalyst9100-powerpointslides-190801165911.pdf
 
jt2019-jt--a26b6c1.pdf
jt2019-jt--a26b6c1.pdfjt2019-jt--a26b6c1.pdf
jt2019-jt--a26b6c1.pdf
 
ASPNET-in-Production.pptx
ASPNET-in-Production.pptxASPNET-in-Production.pptx
ASPNET-in-Production.pptx
 
2nd Report - Major Diagnostic Categories, 2014.pdf
2nd Report - Major Diagnostic Categories, 2014.pdf2nd Report - Major Diagnostic Categories, 2014.pdf
2nd Report - Major Diagnostic Categories, 2014.pdf
 

Recently uploaded

Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixingviprabot1
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 

Recently uploaded (20)

Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixing
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 

Clean Architecture By Jason Taylor

  • 1. Clean Architecture Jason Taylor Join the Conversation #GOTOCph @JasonGtAu
  • 2. Join the Conversation #GOTOCph @JasonGtAu
  • 3.
  • 4. SSW Solution Architect Jason Taylor github.com/jasongt youtube.com/jasongt Join the Conversation #DotNetCoreSuperpowers @SSW_TV jasongtau codingflow.net Visiting from Australia .NET Developer Since 2002 Keep It Simple, Stupid!
  • 5. Clean Architecture Infrastructure Layer Application Layer Presentation Layer Next Steps Domain Layer Agenda
  • 6. Clean Architecture Independent of frameworks Testable Independent of UI Independent of database Independent anything external Join the Conversation #GOTOCph @JasonGtAu Presentation Infrastructure Application Domain
  • 7. Northwind Traders Sample Clean Architecture ASP.NET Core 3.0 Entity Framework Core 3.0 ASP.NET Core Identity 3.0 Repo bit.ly/northwind-traders Join the Conversation #GOTOCph @JasonGtAu
  • 8. Clean Architecture Template .NET Core Template Package ASP.NET Core 3.0 Entity Framework Core 3.0 ASP.NET Core Identity 3.0 Repo bit.ly/ca-sln Join the Conversation #GOTOCph @JasonGtAu
  • 9. Domain contains enterprise-wide logic and types Application contains business-logic and types Infrastructure contains all external concerns Presentation and Infrastructure depend only on Application Infrastructure and Presentation components can be replaced with minimal effort Join the Conversation #GOTOCph @JasonGtAu Key Points
  • 10. Clean Architecture Infrastructure Layer Application Layer Presentation Layer Next Steps Domain Layer Agenda
  • 11. Overview Entities Value Objects Enumerations Logic Exceptions Join the Conversation #GOTOCph @JasonGtAu Presentation Application Infrastructure Domain
  • 12. Demo Reviewing the Domain layer Join the Conversation #GOTOCph @JasonGtAu
  • 13. Avoid using data annotations Use value objects where appropriate Create custom domain exceptions Initialise all collections & use private setters Automatically track changes Join the Conversation #GOTOCph @JasonGtAu Key Points
  • 14. Clean Architecture Infrastructure Layer Application Layer Presentation Layer Next Steps Domain Layer Agenda
  • 15. Overview Interfaces Models Logic Commands / Queries Validators Exceptions Join the Conversation #GOTOCph @JasonGtAu Presentation Application Infrastructure Domain
  • 16. CQRS Command Query Responsibility Segregation Separate reads (queries) from writes (commands) Can maximise performance, scalability, and simplicity Easy to add new features, just add a new query or command Easy to maintain, changes only affect one command or query Join the Conversation #GOTOCph @JasonGtAu
  • 17. CQRS + MediatR = ♥ Define commands and queries as requests Application layer is just a series of request / response objects Ability to attach additional behaviour before and / or after each request, e.g. logging, validation, caching, authorisation and so on Join the Conversation #GOTOCph @JasonGtAu
  • 18. Demo Reviewing the Application layer Join the Conversation #GOTOCph @JasonGtAu
  • 19. Using CQRS + MediatR simplifies your overall design MediatR simplifies cross cutting concerns Fluent Validation is useful for all validation scenarios AutoMapper simplifies mapping and projections Independent of infrastructure concerns Join the Conversation #GOTOCph @JasonGtAu Key Points
  • 20. Clean Architecture Infrastructure Layer Application Layer Presentation Layer Next Steps Domain Layer Agenda
  • 21. Overview Persistence Identity File System System Clock API Clients Join the Conversation #GOTOCph @JasonGtAu Presentation Application Infrastructure Domain
  • 22. Unit of Work and Repository Patterns Should we implement these patterns? It isn’t always the best choice, because: EF Core insulates your code from database changes DbContext acts as a unit of work DbSet acts as a repository EF Core has features for unit testing without repositories Join the Conversation #GOTOCph @JasonGtAu
  • 23. What do the experts think? Join the Conversation #GOTOCph @JasonGtAu I’m over Repositories, and definitely over abstracting your data layer. No, the repository/unit-of-work pattern isn’t useful with EF Core. No, you don’t need a repository. But there are many benefits and you should consider it!
  • 24. Demo Reviewing the Infrastructure layer Join the Conversation #GOTOCph @JasonGtAu
  • 25. Independent of the database Use Fluent API configuration over data annotations Prefer conventions over configuration Automatically apply all entity type configurations No layers depend on Infrastructure layer, e.g. Presentation layer Join the Conversation #GOTOCph @JasonGtAu Key Points
  • 26. Clean Architecture Infrastructure Layer Application Layer Presentation Layer Next Steps Domain Layer Agenda
  • 27. Overview SPA – Angular, React, Vue Web API Razor Pages MVC Web Forms Join the Conversation #GOTOCph @JasonGtAu Presentation Application Infrastructure Domain
  • 28. Demo Reviewing the Presentation layer Join the Conversation #GOTOCph @JasonGtAu
  • 29. Controllers should not contain any application logic Create and consume well defined view models Open API bridges the gap between the front end and back end NSwag automates generation of Open API specification and clients Join the Conversation #GOTOCph @JasonGtAu Key Points
  • 30. Clean Architecture Infrastructure Layer Application Layer Presentation Layer Next Steps Domain Layer Agenda
  • 31. Using the Solution Template Join the Conversation #GOTOCph @JasonGtAu C:CodeCaTodo>dotnet new -i Clean.Architecture.Solution.Template C:CodeCaTodo>dotnet new ca-sln The template "Clean Architecture Solution" was created successfully. C:CodeCaTodo>
  • 32. Join the Conversation #GOTOCph @JasonGtAu
  • 33. Join the Conversation #GOTOCph @JasonGtAu
  • 34. Thank you! info@ssw.com.au www.ssw.com.au Sydney | Melbourne | Brisbane @jasongtau bit.ly/ca-sln bit.ly/northwind-traders