SlideShare a Scribd company logo
1 of 26
1
Let your application be equally driven
by users and tests
Clean architecture
2
Nenad Jankovski
 Backend Java developer
 Passionate about:
• Clean code
• Clean architecture
• System design
• Agile methodologies
• FC Bayern München 
About me
Clean Architecture
3
Why architecture matters
Clean Architecture
Benefits of good architecture
How to achieve good architecture
 Don’t be overconfident!
 Remember the race of the turtle
and the hare?
4
The tale of two values
Behavior - states what the software can do
Structure - the ease and promptness of creating and
changing features in an existing system
4
Clean Architecture
5
The tale of two values
Clean Architecture
Not Urgent
Urgent
Important
Not
Important
Urgent and Important
The Feature That
Stakeholders Need Most
Not Urgent and
Important
Architecture itself
Urgent and Not
Important
A feature that may be
just beautification
Not Urgent and Not
Important
Features with small
contributions
Dwight D. Eisenhower Matrix
I have two kinds of problems, the urgent and
the important. The urgent are not important,
and the important are never urgent.
If we translate this quote into the software
world then we can conclude that behaviour is
urgent but not important and structure is
important but not urgent.
5
6
The struggle
Clean Architecture
6
7
Layered architecture
Clean Architecture
Presentation
Layer
Business
Layer
Data
Layer
8
Layered architecture
Clean Architecture
Presentation
Layer
Application
Layer
Domain
Layer
Infrastructure
Layer
9
Layered architecture
Clean Architecture
Substitute layers with
alternative implementations
Defer decisions about layer
implementation
Dependencies between layers are
minimized
 Coupling is evil, it kills you.
 Big bowl of mud is coupling gone crazy
10
Coupling is the property that one
module is forced to change because
another one changes
Cohesion is the property that a
module is subject to the same forces
of change
Layered architecture
Clean Architecture
Low coupling, high cohesion
11
The domain layer. Contains two
types of business logic
1. Domain logic
2. Application logic
There are two basic
implementation logic to split the
domain layer
1. Domain façade – Apart from the
application logic, no other logic
2. Operation script – CRUD based
service
Layered architecture
Clean Architecture
11
Domain logic layer can be split
into two layers
1. Service Layer
2. Entity layer
12
Layered Architecture
+
Dependency Inversion
12
The Clean Architecture
13
Clean Architecture
14
Ports and adapters
(aka Hexagonal
architecture)
Onion architecture
Screaming
architecture
Clean architecture
Layered architecture +
dependency inversion
BCE – Boundary
controller entity
Clean Architecture
15
Clean Architecture
15
Ivar Jacobson
Boundary-Controller-Entity
(BCE) Architecture
Alistair Cockburn
Hexagonal (Ports &
Adapters) Architecture
Jeffrey Palermo
Onion Architecture
Robert C. Martin
Screaming Architecture
Clen Architecture
16
The Clean Architecture
Clean Architecture
Entities
Use Cases
Controllers
External
Interfaces
DB UI
Web
Devices
Enterprise Business Rules
Application Business Rules
Interface Adapters
Frameworks & Drivers
Presenter
Controller
Use Case
Outout Port
Use Case
Interactor
Use Case
Input Port
<I>
<I>
Flow of control
17
Clean architecture – data flow
Clean Architecture
View Model
Presenter
Controller
View
Request Model
Boundary
Boundary
Resonse Model
<I>
<I>
Interactor
Entity Gateway
Entity Gateway
Implementation
Database Api
Entity
Entity
Entity
<I>
18
Implementing clean
architecture
Clean Architecture
Open Closed Principle (OCP)
Liskov Substitution Principle (LSP)
Interface Segregation Principle (ISP)
Dependency Inversion Principle (DIP)
Single Responsibility Principle (SRP)
18
19
Dependency Inversion Principle (DIP)
Clean Architecture
20
Component principles
Clean Architecture
Reuse/Release Equivalence
Principle (REP)
Common Closure Principle (CCP)
Common Reuse Principle (CRP)
Acyclic Dependency Principle (ADP)
Stable Dependency Principle (SDP)
Stable Abstraction Principle (SAP)
21
Pros and Cons
Clean Architecture
PROS CONS
Doman stability Heavy (in classes)
Testing Indirect (a lot of interfaces)
Framework independence Learning curve (dep. inversion)
Database independence
UI Independent
Readability
Flexible
22
Hints
22
Don’t use your Entity objects as data
structures to pass around in the outer
layers. Create separate data model
objects for that.
The top-level organization of your project
should clearly tell people what your
project is all about.
This is called screaming architecture.
Clean Architecture
23
Clean Architecture
24
Talk is Cheap
Clean Architecture
24
Show me
The Code!!
25
Q&A
25
Clean Architecture
26
Thank you!
+359 2424 6484
www.scalefocus.com

More Related Content

Similar to JavaBeer_Clean architecture_update.v2.pptx

ASAS 2014 - Simon Brown
ASAS 2014 - Simon BrownASAS 2014 - Simon Brown
ASAS 2014 - Simon BrownAvisi B.V.
 
When Architecture Meets Data
When Architecture Meets DataWhen Architecture Meets Data
When Architecture Meets DataEoin Woods
 
Crafting ColdFusion Applications like an Architect
Crafting ColdFusion Applications like an ArchitectCrafting ColdFusion Applications like an Architect
Crafting ColdFusion Applications like an ArchitectColdFusionConference
 
Sharepoint 2013-applied architecture from the field v3 (public)
Sharepoint 2013-applied architecture from the field v3 (public)Sharepoint 2013-applied architecture from the field v3 (public)
Sharepoint 2013-applied architecture from the field v3 (public)Tihomir Ignatov
 
Struts & hibernate ppt
Struts & hibernate pptStruts & hibernate ppt
Struts & hibernate pptPankaj Patel
 
Architecture vs. Design in Agile: What’s the Right Answer?
Architecture vs. Design in Agile: What’s the Right Answer?Architecture vs. Design in Agile: What’s the Right Answer?
Architecture vs. Design in Agile: What’s the Right Answer?TechWell
 
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...apidays
 
Fifteen Years of DevOps -- LISA 2012 keynote
Fifteen Years of DevOps -- LISA 2012 keynoteFifteen Years of DevOps -- LISA 2012 keynote
Fifteen Years of DevOps -- LISA 2012 keynoteGeoff Halprin
 
Microservices Architecture - Cloud Native Apps
Microservices Architecture - Cloud Native AppsMicroservices Architecture - Cloud Native Apps
Microservices Architecture - Cloud Native AppsAraf Karsh Hamid
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as CodePrasant Kumar
 
OutSystems User Groups - Introduction to OutSystems Architecture (Pune - 7 A...
 OutSystems User Groups - Introduction to OutSystems Architecture (Pune - 7 A... OutSystems User Groups - Introduction to OutSystems Architecture (Pune - 7 A...
OutSystems User Groups - Introduction to OutSystems Architecture (Pune - 7 A...OutSystemsNeo
 
Building Enterprise Application with J2EE
Building Enterprise Application with J2EEBuilding Enterprise Application with J2EE
Building Enterprise Application with J2EECalance
 
Modern Agile Software Architecture
Modern Agile Software ArchitectureModern Agile Software Architecture
Modern Agile Software ArchitectureKannan Durairaj
 
MA Microservices Meetup: Move fast and make things
MA Microservices Meetup: Move fast and make thingsMA Microservices Meetup: Move fast and make things
MA Microservices Meetup: Move fast and make thingsAmbassador Labs
 
Clean architecture with asp.net core
Clean architecture with asp.net coreClean architecture with asp.net core
Clean architecture with asp.net coreSam Nasr, MCSA, MVP
 

Similar to JavaBeer_Clean architecture_update.v2.pptx (20)

IEC.ppt
IEC.pptIEC.ppt
IEC.ppt
 
Chapter1
Chapter1Chapter1
Chapter1
 
L02 Architecture
L02 ArchitectureL02 Architecture
L02 Architecture
 
ASAS 2014 - Simon Brown
ASAS 2014 - Simon BrownASAS 2014 - Simon Brown
ASAS 2014 - Simon Brown
 
When Architecture Meets Data
When Architecture Meets DataWhen Architecture Meets Data
When Architecture Meets Data
 
Crafting ColdFusion Applications like an Architect
Crafting ColdFusion Applications like an ArchitectCrafting ColdFusion Applications like an Architect
Crafting ColdFusion Applications like an Architect
 
Sharepoint 2013-applied architecture from the field v3 (public)
Sharepoint 2013-applied architecture from the field v3 (public)Sharepoint 2013-applied architecture from the field v3 (public)
Sharepoint 2013-applied architecture from the field v3 (public)
 
Struts & hibernate ppt
Struts & hibernate pptStruts & hibernate ppt
Struts & hibernate ppt
 
Architecture vs. Design in Agile: What’s the Right Answer?
Architecture vs. Design in Agile: What’s the Right Answer?Architecture vs. Design in Agile: What’s the Right Answer?
Architecture vs. Design in Agile: What’s the Right Answer?
 
Software Architecture in an Agile World
Software Architecture in an Agile WorldSoftware Architecture in an Agile World
Software Architecture in an Agile World
 
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...
 
Fifteen Years of DevOps -- LISA 2012 keynote
Fifteen Years of DevOps -- LISA 2012 keynoteFifteen Years of DevOps -- LISA 2012 keynote
Fifteen Years of DevOps -- LISA 2012 keynote
 
Microservices Architecture - Cloud Native Apps
Microservices Architecture - Cloud Native AppsMicroservices Architecture - Cloud Native Apps
Microservices Architecture - Cloud Native Apps
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as Code
 
OutSystems User Groups - Introduction to OutSystems Architecture (Pune - 7 A...
 OutSystems User Groups - Introduction to OutSystems Architecture (Pune - 7 A... OutSystems User Groups - Introduction to OutSystems Architecture (Pune - 7 A...
OutSystems User Groups - Introduction to OutSystems Architecture (Pune - 7 A...
 
Building Enterprise Application with J2EE
Building Enterprise Application with J2EEBuilding Enterprise Application with J2EE
Building Enterprise Application with J2EE
 
Modern Agile Software Architecture
Modern Agile Software ArchitectureModern Agile Software Architecture
Modern Agile Software Architecture
 
MA Microservices Meetup: Move fast and make things
MA Microservices Meetup: Move fast and make thingsMA Microservices Meetup: Move fast and make things
MA Microservices Meetup: Move fast and make things
 
Architectural design
Architectural designArchitectural design
Architectural design
 
Clean architecture with asp.net core
Clean architecture with asp.net coreClean architecture with asp.net core
Clean architecture with asp.net core
 

Recently uploaded

Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 

Recently uploaded (20)

Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 

JavaBeer_Clean architecture_update.v2.pptx