SlideShare a Scribd company logo
Hexagonal Architecture
Nicolas Guignard
Allow an application to equally be driven by users, programs,
automated test, and to be developed and tested in isolation from
its eventual run-time devices and databases.
Intent
● Clean Architecture
● Ports/Adapters
● Left wing side/right side
● Domain-driven design
● Evolutive architecture / VIPER…
Other similar
architectures/buzzwords?
HEXAGONAL ARCHITECTURE
How does the kitchen of a chef look like?
Why do we need it?
How does the kitchen of a chef look like?
Why do we need it?
Image from Shutterstock here
Software is a living creature that needs to
Why do we need a good architecture?
Be maintainable
Evolve
Do several similar and very different things
Be flexible
Be testable Self explanatory
● Put the software at the service of the business.
● Technology is a detail, business is what matters.
● Can your PO read your tests or your code and understands what it does ?
● Push for independence of the business area from the technology infrastructure
● Make it easy to evolve
● Allow re-usability
What is the goal of the Hexagonal
Architecture?
How is the Hexagonal Architecture
working?
● Separate the Domain - Business from the rest
How is the Hexagonal Architecture
working?
How is the Hexagonal Architecture
working?
● Technical layers have dependencies with the domain, outside-in
How is the Hexagonal Architecture
working?
This looks like some Circle Architecture no ?
Not reallyyyyyyyy
How is the Hexagonal Architecture
working?
How is the Hexagonal Architecture
working?
How is the Hexagonal Architecture
working?
● Users / Application:
○ What is provided to the end user of our domain
○ They need us
● Providers / Infrastructure:
○ What we depend on
How is the Hex-Archi working for instance
for us?
How is the Hex-Archi working for instance
for us?
At compile time:
At compile time:
Class diagram
How is the Hex-Archi working for instance
for us?
At runtime:
public class Program {
public static void Main(String[] args)
{
// 1. Instantiate right-side adapter ("Infrastructure most likely in our case")
// What we depend on
SomeOtherPort infraAdapter = new SomeKindOfAdapter("argument");
// 2. Instantiate the Domain
// Our business logic
ISomePort domain = new LogicThanImplementSomePort(infraAdapter);
// 3. Instantiate the application side
// What our users depend on
SomeRestController controller = new SomeRestController(domain);
}
}
Details
● Ports:
○ Interfaces
○ Contract to respect for adapter
● Adapters:
○ Implement interfaces
○ Are interchangeables
○ Are throwable
○ Are mockable
● Example:
○ Replace PostgreSQL by Oracle → no impact on the domain
○ Replace RabbitMQ by Kafka →
Details
● Domain:
○ Should use domain language only
○ Should be easy to unit test
○ Could have easily implemented behaviour driven test
○ Could be Domain-driven designed
○ MUST not have any dependency on other parts of the application
○ Lean on Dependency Injection and pass only interfaces
Details
● Testing Strategy:
○ Mock / stub / fake your infrastructure adapters
○ Test the whole domain independently of infrastructure or application
○ Can test: Application → Domain
○ Can test: Domain → Infrastructure
○ MUST STILL test infrastructure and application parts
A good architect defers decisions
Quote?
BUT ...
● Beware:
○ Your database model isn’t your domain model.
○ You don’t start designing your db to build your domain model
● Challenge yourself:
○ Can your PO/PM write the BDD test for you and read your code and understand it? If yes:
congrats, your architecture should be quite neat and be able to evolve.
○ Embrace changes, to do so you will have to improve your code base and architecture
○ Self discipline
TIPS ...
● Multi module projects with right dependencies
● Define your domain language to align everybody
● Ask yourself:
○ Is your code easily testable ?
○ Does it use heavily mocks ? → could be a bad smell
○ Are your decisions reversible? They should be
● The less modules/packages and your code is coupled the better you’ll be
● You want to use different technologies for Application/domain/infra → DO IT, you can, don‘t
base your architecture on the language you use
Does it scale?
Yes but what if ?
Annexe and content we took ideas from
● https://fr.slideshare.net/nicolascarlo1/hexagonal-architecture-elixir
● https://fr.slideshare.net/ThomasPierrain/coder-sans-peur-du-changement-avec-la-meme-pas-mal-hexagonal-architecture
● https://blog.octo.com/en/hexagonal-architecture-three-principles-and-an-implementation-example/
● https://fr.slideshare.net/nicolascarlo1/the-secrets-of-hexagonal-architecture
Thank You
www.online-pajak.com
QUESTIONS ?

More Related Content

What's hot

Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
NSCoder Mexico
 
Clean Architecture Essentials - Stockholm Software Craftsmanship
Clean Architecture Essentials - Stockholm Software CraftsmanshipClean Architecture Essentials - Stockholm Software Craftsmanship
Clean Architecture Essentials - Stockholm Software Craftsmanship
Ivan Paulovich
 
2012 the clean architecture by Uncle bob
2012 the clean architecture by Uncle bob 2012 the clean architecture by Uncle bob
2012 the clean architecture by Uncle bob
GEORGE LEON
 
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Steve Pember
 
Clean architecture on android
Clean architecture on androidClean architecture on android
Clean architecture on android
Benjamin Cheng
 
Clean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a MonolithClean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a Monolith
Victor Rentea
 
Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
Richard Dingwall
 
Hexagonal Architecture.pdf
Hexagonal Architecture.pdfHexagonal Architecture.pdf
Hexagonal Architecture.pdf
VladimirRadzivil
 
Clean architecture
Clean architectureClean architecture
Clean architecture
Travis Frisinger
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
Badoo
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven Design
David Berliner
 
Clean architecture with asp.net core
Clean architecture with asp.net coreClean architecture with asp.net core
Clean architecture with asp.net core
Sam Nasr, MCSA, MVP
 
DDD Tactical Design with Clean Architecture - Ivan Paulovich
DDD Tactical Design with Clean Architecture - Ivan PaulovichDDD Tactical Design with Clean Architecture - Ivan Paulovich
DDD Tactical Design with Clean Architecture - Ivan Paulovich
Ivan Paulovich
 
Clean architecture
Clean architectureClean architecture
Clean architecture
Lieven Doclo
 
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
Carlos Buenosvinos
 
Clean architecture
Clean architectureClean architecture
Clean architecture
.NET Crowd
 
GraphQL
GraphQLGraphQL
Clean architecture - Protecting the Domain
Clean architecture - Protecting the DomainClean architecture - Protecting the Domain
Clean architecture - Protecting the Domain
Victor Rentea
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
Amit Mukherjee
 
Real Life Clean Architecture
Real Life Clean ArchitectureReal Life Clean Architecture
Real Life Clean Architecture
Mattia Battiston
 

What's hot (20)

Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
 
Clean Architecture Essentials - Stockholm Software Craftsmanship
Clean Architecture Essentials - Stockholm Software CraftsmanshipClean Architecture Essentials - Stockholm Software Craftsmanship
Clean Architecture Essentials - Stockholm Software Craftsmanship
 
2012 the clean architecture by Uncle bob
2012 the clean architecture by Uncle bob 2012 the clean architecture by Uncle bob
2012 the clean architecture by Uncle bob
 
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
 
Clean architecture on android
Clean architecture on androidClean architecture on android
Clean architecture on android
 
Clean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a MonolithClean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a Monolith
 
Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
 
Hexagonal Architecture.pdf
Hexagonal Architecture.pdfHexagonal Architecture.pdf
Hexagonal Architecture.pdf
 
Clean architecture
Clean architectureClean architecture
Clean architecture
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven Design
 
Clean architecture with asp.net core
Clean architecture with asp.net coreClean architecture with asp.net core
Clean architecture with asp.net core
 
DDD Tactical Design with Clean Architecture - Ivan Paulovich
DDD Tactical Design with Clean Architecture - Ivan PaulovichDDD Tactical Design with Clean Architecture - Ivan Paulovich
DDD Tactical Design with Clean Architecture - Ivan Paulovich
 
Clean architecture
Clean architectureClean architecture
Clean architecture
 
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
A Journey from Hexagonal Architecture to Event Sourcing - SymfonyCon Cluj 2017
 
Clean architecture
Clean architectureClean architecture
Clean architecture
 
GraphQL
GraphQLGraphQL
GraphQL
 
Clean architecture - Protecting the Domain
Clean architecture - Protecting the DomainClean architecture - Protecting the Domain
Clean architecture - Protecting the Domain
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Real Life Clean Architecture
Real Life Clean ArchitectureReal Life Clean Architecture
Real Life Clean Architecture
 

Similar to Hexagonal architecture

Develop, deploy, and operate services at reddit scale oscon 2018
Develop, deploy, and operate services at reddit scale   oscon 2018Develop, deploy, and operate services at reddit scale   oscon 2018
Develop, deploy, and operate services at reddit scale oscon 2018
Gregory Taylor
 
LAS16-108: JerryScript and other scripting languages for IoT
LAS16-108: JerryScript and other scripting languages for IoTLAS16-108: JerryScript and other scripting languages for IoT
LAS16-108: JerryScript and other scripting languages for IoT
Linaro
 
Introduction to DevOps and the Practical Use Cases at Credit OK
Introduction to DevOps and the Practical Use Cases at Credit OKIntroduction to DevOps and the Practical Use Cases at Credit OK
Introduction to DevOps and the Practical Use Cases at Credit OK
Kriangkrai Chaonithi
 
Software Architecture - All you need to know
Software Architecture - All you need to knowSoftware Architecture - All you need to know
Software Architecture - All you need to know
Vincent Composieux
 
Meetup 2020 - Back to the Basics part 101 : IaC
Meetup 2020 - Back to the Basics part 101 : IaCMeetup 2020 - Back to the Basics part 101 : IaC
Meetup 2020 - Back to the Basics part 101 : IaC
DamienCarpy
 
Evolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand RaoEvolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand Rao
VMware Tanzu
 
From class to architecture
From class to architectureFrom class to architecture
From class to architecture
Marcin Hawraniak
 
On component interface
On component interfaceOn component interface
On component interface
Laurence Chen
 
Javascript Programming according to Industry Standards.pptx
Javascript Programming according to Industry Standards.pptxJavascript Programming according to Industry Standards.pptx
Javascript Programming according to Industry Standards.pptx
MukundSonaiya1
 
Keeping code clean
Keeping code cleanKeeping code clean
Keeping code clean
Brett Child
 
Data Science in Production: Technologies That Drive Adoption of Data Science ...
Data Science in Production: Technologies That Drive Adoption of Data Science ...Data Science in Production: Technologies That Drive Adoption of Data Science ...
Data Science in Production: Technologies That Drive Adoption of Data Science ...
Nir Yungster
 
From prototype to production - The journey of re-designing SmartUp.io
From prototype to production - The journey of re-designing SmartUp.ioFrom prototype to production - The journey of re-designing SmartUp.io
From prototype to production - The journey of re-designing SmartUp.io
Máté Lang
 
Bighead: Airbnb’s End-to-End Machine Learning Platform with Krishna Puttaswa...
 Bighead: Airbnb’s End-to-End Machine Learning Platform with Krishna Puttaswa... Bighead: Airbnb’s End-to-End Machine Learning Platform with Krishna Puttaswa...
Bighead: Airbnb’s End-to-End Machine Learning Platform with Krishna Puttaswa...
Databricks
 
AirBNB's ML platform - BigHead
AirBNB's ML platform - BigHeadAirBNB's ML platform - BigHead
AirBNB's ML platform - BigHead
Karthik Murugesan
 
Yotpo microservices
Yotpo microservicesYotpo microservices
Yotpo microservices
Ron Barabash
 
Effective cplusplus
Effective cplusplusEffective cplusplus
Effective cplusplus
Mark Veltzer
 
APIDays SF 2019: Managing multiple api stacks on serverless
APIDays SF 2019: Managing multiple api stacks on serverlessAPIDays SF 2019: Managing multiple api stacks on serverless
APIDays SF 2019: Managing multiple api stacks on serverless
Alexander Graebe
 
DDD with Behat
DDD with BehatDDD with Behat
DDD with Behat
Anton Serdyuk
 
Serverless - DevOps Lessons Learned From Production
Serverless - DevOps Lessons Learned From ProductionServerless - DevOps Lessons Learned From Production
Serverless - DevOps Lessons Learned From Production
Steve Hogg
 
SACON NY 19: "Creating an effective developer experience for cloud-native apps"
SACON NY 19: "Creating an effective developer experience for cloud-native apps"SACON NY 19: "Creating an effective developer experience for cloud-native apps"
SACON NY 19: "Creating an effective developer experience for cloud-native apps"
Daniel Bryant
 

Similar to Hexagonal architecture (20)

Develop, deploy, and operate services at reddit scale oscon 2018
Develop, deploy, and operate services at reddit scale   oscon 2018Develop, deploy, and operate services at reddit scale   oscon 2018
Develop, deploy, and operate services at reddit scale oscon 2018
 
LAS16-108: JerryScript and other scripting languages for IoT
LAS16-108: JerryScript and other scripting languages for IoTLAS16-108: JerryScript and other scripting languages for IoT
LAS16-108: JerryScript and other scripting languages for IoT
 
Introduction to DevOps and the Practical Use Cases at Credit OK
Introduction to DevOps and the Practical Use Cases at Credit OKIntroduction to DevOps and the Practical Use Cases at Credit OK
Introduction to DevOps and the Practical Use Cases at Credit OK
 
Software Architecture - All you need to know
Software Architecture - All you need to knowSoftware Architecture - All you need to know
Software Architecture - All you need to know
 
Meetup 2020 - Back to the Basics part 101 : IaC
Meetup 2020 - Back to the Basics part 101 : IaCMeetup 2020 - Back to the Basics part 101 : IaC
Meetup 2020 - Back to the Basics part 101 : IaC
 
Evolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand RaoEvolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand Rao
 
From class to architecture
From class to architectureFrom class to architecture
From class to architecture
 
On component interface
On component interfaceOn component interface
On component interface
 
Javascript Programming according to Industry Standards.pptx
Javascript Programming according to Industry Standards.pptxJavascript Programming according to Industry Standards.pptx
Javascript Programming according to Industry Standards.pptx
 
Keeping code clean
Keeping code cleanKeeping code clean
Keeping code clean
 
Data Science in Production: Technologies That Drive Adoption of Data Science ...
Data Science in Production: Technologies That Drive Adoption of Data Science ...Data Science in Production: Technologies That Drive Adoption of Data Science ...
Data Science in Production: Technologies That Drive Adoption of Data Science ...
 
From prototype to production - The journey of re-designing SmartUp.io
From prototype to production - The journey of re-designing SmartUp.ioFrom prototype to production - The journey of re-designing SmartUp.io
From prototype to production - The journey of re-designing SmartUp.io
 
Bighead: Airbnb’s End-to-End Machine Learning Platform with Krishna Puttaswa...
 Bighead: Airbnb’s End-to-End Machine Learning Platform with Krishna Puttaswa... Bighead: Airbnb’s End-to-End Machine Learning Platform with Krishna Puttaswa...
Bighead: Airbnb’s End-to-End Machine Learning Platform with Krishna Puttaswa...
 
AirBNB's ML platform - BigHead
AirBNB's ML platform - BigHeadAirBNB's ML platform - BigHead
AirBNB's ML platform - BigHead
 
Yotpo microservices
Yotpo microservicesYotpo microservices
Yotpo microservices
 
Effective cplusplus
Effective cplusplusEffective cplusplus
Effective cplusplus
 
APIDays SF 2019: Managing multiple api stacks on serverless
APIDays SF 2019: Managing multiple api stacks on serverlessAPIDays SF 2019: Managing multiple api stacks on serverless
APIDays SF 2019: Managing multiple api stacks on serverless
 
DDD with Behat
DDD with BehatDDD with Behat
DDD with Behat
 
Serverless - DevOps Lessons Learned From Production
Serverless - DevOps Lessons Learned From ProductionServerless - DevOps Lessons Learned From Production
Serverless - DevOps Lessons Learned From Production
 
SACON NY 19: "Creating an effective developer experience for cloud-native apps"
SACON NY 19: "Creating an effective developer experience for cloud-native apps"SACON NY 19: "Creating an effective developer experience for cloud-native apps"
SACON NY 19: "Creating an effective developer experience for cloud-native apps"
 

Recently uploaded

Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
YousufSait3
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
ssuserad3af4
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
mz5nrf0n
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 

Recently uploaded (20)

Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 

Hexagonal architecture

  • 2. Allow an application to equally be driven by users, programs, automated test, and to be developed and tested in isolation from its eventual run-time devices and databases. Intent
  • 3. ● Clean Architecture ● Ports/Adapters ● Left wing side/right side ● Domain-driven design ● Evolutive architecture / VIPER… Other similar architectures/buzzwords? HEXAGONAL ARCHITECTURE
  • 4. How does the kitchen of a chef look like? Why do we need it?
  • 5. How does the kitchen of a chef look like? Why do we need it? Image from Shutterstock here
  • 6. Software is a living creature that needs to Why do we need a good architecture? Be maintainable Evolve Do several similar and very different things Be flexible Be testable Self explanatory
  • 7. ● Put the software at the service of the business. ● Technology is a detail, business is what matters. ● Can your PO read your tests or your code and understands what it does ? ● Push for independence of the business area from the technology infrastructure ● Make it easy to evolve ● Allow re-usability What is the goal of the Hexagonal Architecture?
  • 8. How is the Hexagonal Architecture working? ● Separate the Domain - Business from the rest
  • 9. How is the Hexagonal Architecture working?
  • 10. How is the Hexagonal Architecture working? ● Technical layers have dependencies with the domain, outside-in
  • 11. How is the Hexagonal Architecture working? This looks like some Circle Architecture no ? Not reallyyyyyyyy
  • 12. How is the Hexagonal Architecture working?
  • 13. How is the Hexagonal Architecture working?
  • 14. How is the Hexagonal Architecture working? ● Users / Application: ○ What is provided to the end user of our domain ○ They need us ● Providers / Infrastructure: ○ What we depend on
  • 15. How is the Hex-Archi working for instance for us?
  • 16. How is the Hex-Archi working for instance for us? At compile time:
  • 18. How is the Hex-Archi working for instance for us? At runtime: public class Program { public static void Main(String[] args) { // 1. Instantiate right-side adapter ("Infrastructure most likely in our case") // What we depend on SomeOtherPort infraAdapter = new SomeKindOfAdapter("argument"); // 2. Instantiate the Domain // Our business logic ISomePort domain = new LogicThanImplementSomePort(infraAdapter); // 3. Instantiate the application side // What our users depend on SomeRestController controller = new SomeRestController(domain); } }
  • 19. Details ● Ports: ○ Interfaces ○ Contract to respect for adapter ● Adapters: ○ Implement interfaces ○ Are interchangeables ○ Are throwable ○ Are mockable ● Example: ○ Replace PostgreSQL by Oracle → no impact on the domain ○ Replace RabbitMQ by Kafka →
  • 20. Details ● Domain: ○ Should use domain language only ○ Should be easy to unit test ○ Could have easily implemented behaviour driven test ○ Could be Domain-driven designed ○ MUST not have any dependency on other parts of the application ○ Lean on Dependency Injection and pass only interfaces
  • 21. Details ● Testing Strategy: ○ Mock / stub / fake your infrastructure adapters ○ Test the whole domain independently of infrastructure or application ○ Can test: Application → Domain ○ Can test: Domain → Infrastructure ○ MUST STILL test infrastructure and application parts
  • 22. A good architect defers decisions Quote?
  • 23. BUT ... ● Beware: ○ Your database model isn’t your domain model. ○ You don’t start designing your db to build your domain model ● Challenge yourself: ○ Can your PO/PM write the BDD test for you and read your code and understand it? If yes: congrats, your architecture should be quite neat and be able to evolve. ○ Embrace changes, to do so you will have to improve your code base and architecture ○ Self discipline
  • 24. TIPS ... ● Multi module projects with right dependencies ● Define your domain language to align everybody ● Ask yourself: ○ Is your code easily testable ? ○ Does it use heavily mocks ? → could be a bad smell ○ Are your decisions reversible? They should be ● The less modules/packages and your code is coupled the better you’ll be ● You want to use different technologies for Application/domain/infra → DO IT, you can, don‘t base your architecture on the language you use
  • 25. Does it scale? Yes but what if ?
  • 26. Annexe and content we took ideas from ● https://fr.slideshare.net/nicolascarlo1/hexagonal-architecture-elixir ● https://fr.slideshare.net/ThomasPierrain/coder-sans-peur-du-changement-avec-la-meme-pas-mal-hexagonal-architecture ● https://blog.octo.com/en/hexagonal-architecture-three-principles-and-an-implementation-example/ ● https://fr.slideshare.net/nicolascarlo1/the-secrets-of-hexagonal-architecture