SlideShare a Scribd company logo
1 of 42
Download to read offline
A very simple hexagonal
architecture implementation in java
Dan MAGIER
1
2
3
Dan Magier
CEO
+33683224954
dan@heiwa-it.com
www.heiwa-it.com
Adresse - Paris - France
Dan Magier
CEO
+33683224954
dan@heiwa-it.com
www.heiwa-it.com
Adresse - Paris - France
https://www.linkedin.com/in/dan-magier-67a9374/


@MagierDan


dan@heiwa-it.com
GOALS
4
HEXAGONAL ARCHITECTURE GOAL(S)
Main goal


Separate the domain code from the technical code


5
HEXAGONAL ARCHITECTURE GOAL(S)
Sub goals


1. De
fi
ne a Domain Speci
fi
c Language (DSL)


6
HEXAGONAL ARCHITECTURE GOAL(S)
Sub goals


1. De
fi
ne a Domain Speci
fi
c Language (DSL)


2. Switch easily between technologies
without changing domain code


7
hexagonal architecture
Components
8
HEXAGONAL ARCHITECTURE COMPONENTS
➤ A hexagon representing the domain


Create your DSL with all the people involved on the project if
possible (BIZ, DEV and QA)


Domain code
9
HEXAGONAL ARCHITECTURE COMPONENTS
10
The domain represented by a java maven module here
HEXAGONAL ARCHITECTURE COMPONENTS
11
The Domain Specific Language
HEXAGONAL ARCHITECTURE COMPONENTS
➤ A hexagon representing the domain


➤ The ports provided by the hexagon


A port represent the intention of the dialog


Don’t think of it as (only) a technical part (as a Java interface
for instance)


« This is for …ing"
Domain code
: port
12
HEXAGONAL ARCHITECTURE COMPONENTS
13
Ports can be represented in Java by an interface
HEXAGONAL ARCHITECTURE COMPONENTS
➤ A hexagon representing the domain


➤ The ports provided by the hexagon


➤ The adapters containing the technical code


The domain is sel
fi
sh. It speaks only its own
language with the infrastructure
14
HEXAGONAL ARCHITECTURE COMPONENTS
15
An adapter implementing the intention of the previous port
HEXAGONAL ARCHITECTURE COMPONENTS
Oracle
DB
Adapter


(Technical code)
Web


Interface
Infrastructure providing data to
the domain
Infrastructure consuming data
from the domain
Adapter


(Technical code)
Domain code
: port
16
HEXAGONAL ARCHITECTURE OTHERS ELEMENTS
➤ To the left of the hexagon, we have the primary actors, the one
who trigger the system, composed of drivers (cause the
application to take action)


➤ To the right of the hexagon, we have the secondary actor, the
one triggered, composed of recipients (get noti
fi
ed by the
application) and repositories (provide data to the application)
17
BENEFITS
18
THE BENEFITS
Separation of concerns


The domain code is « completely » independent of the
infrastructure code:


➤ avoid to mix domain and technical code


➤ Ease the technology watch


19
THE BENEFITS
➤ Separation of concerns


➤ Domain centric language via the DSL => DDD
20
THE BENEFITS
➤ Separation of concerns


➤ Domain centric language via the DSL => DDD


➤ Testing (
fi
rst) easily with or without having the
physical infrastructure
21
THE BENEFITS
➤ Separation of concerns


➤ Domain centric language via the DSL => DDD


➤ Testing easily without having the physical infrastructure


➤ Easy to implements another adapter for a new
technology


=> change technology easily without changing domain code :
oracle adapter to mongodb adapter
22
HEXAGONAL ARCHITECTURE REPRESENTATION
Domain code
Oracle
DB
Mongo
DB
Adapter


(Technical code)
Adapter


(Technical code)
23
Multiple adapters for one port without changing domain code : port
HOW DO WE DO IT ?
24
HOW DO WE DO IT ?
Dependency Inversion


- High-level modules should not depend on low-level modules. Both should
depend on abstractions.


- Abstractions should not depend on details. Details should depend on
abstractions.


25
HOW DO WE DO IT ?
26
Dependency Inversion: The intention defined by the high level component (Domain)
HOW DO WE DO IT ?
27
Dependency Inversion: The low level component (Infrastructure) respecting the previous intention
HOW DO WE DO IT ?
Dependency Injection


(Con
fi
gurable dependency)


In software engineering, dependency injection is a technique whereby one
object supplies the dependencies of another object.
A dependency is an object that can be used (a service).
An injection is the passing of a dependency to a dependent object (a client) that
would use it. 
28
HOW DO WE DO IT ?
29
Dependency Injection: Constructor injection in the present example in the Domain
HOW DO WE DO IT ?
30
Dependency Injection: Constructor injection in the present example in the Driver Infrastructure
HOW DO WE DO IT ?
It’s just common sense


Just di
ff
erentiate what’s part of the domain and what’s part of
the infrastructure


Beware to not create object mixing domain and technical part


31
CONCLUSION
32
HEXAGONAL ARCHITECTURE COMPONENTS
Oracle
DB
Adapter


(Technical code)
Web


Interface
Infrastructure providing data to
the domain
Infrastructure consuming data
from the domain
Adapter


(Technical code)
Domain code
33
: port
CONCLUSION
➤ Separate the domain and the infrastructure parts
34
CONCLUSION
➤ Separate the domain and the infrastructure parts


➤ Involve, if possible, all the team member to
de
fi
ne your Domain language
35
CONCLUSION
➤ Separate the domain and the infrastructure parts


➤ Involve, if possible, all the team member to de
fi
ne your
Domain language


➤ The domain is sel
fi
sh. It speaks only with its
language with the infrastructure
36
CONCLUSION
➤ Separate the domain and the infrastructure parts


➤ Involve, if possible, all the team member to de
fi
ne your
Domain language


➤ The domain is sel
fi
sh. It speaks only with its language with
the infrastructure


➤ Do not create objects mixing domain and
infrastructure parts
37
CONCLUSION
➤ Separate the domain and the infrastructure parts


➤ Involve, if possible, all the team member to de
fi
ne your
Domain language


➤ The domain is sel
fi
sh. It speaks only with its language with
the infrastructure


➤ Do not create objects between domain and infrastructure
parts


➤ It’s a real thing ^^
38
It’s a very simple architecture


Just do it ;-)
39
REFERENCES
➤ http://alistair.cockburn.us/Hexagonal+Architecture+FAQ


➤ http://alistair.cockburn.us/Hexagonal+architecture


➤ https://gist.github.com/sroccaserra/
d37aa6538696b5d94369ab13fbe3e63b
40
THANK YOU


Q&A
41
IT’S NOT FINISHED!


YOUR TURN ^^


https://github.com/HEIWA-IT/trippricer-workshop
42

More Related Content

What's hot

Delivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWSDelivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWSNGINX, Inc.
 
Load-testing 101 for Startups with Artillery.io
Load-testing 101 for Startups with Artillery.ioLoad-testing 101 for Startups with Artillery.io
Load-testing 101 for Startups with Artillery.ioHassy Veldstra
 
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개if kakao
 
멀티클라우드 Service Mesh
멀티클라우드 Service Mesh멀티클라우드 Service Mesh
멀티클라우드 Service MeshJeong-Ho Na
 
오픈스택 커뮤니티 소개 및 기술 동향
오픈스택 커뮤니티 소개 및 기술 동향오픈스택 커뮤니티 소개 및 기술 동향
오픈스택 커뮤니티 소개 및 기술 동향Nalee Jang
 
Reverse proxy & web cache with NGINX, HAProxy and Varnish
Reverse proxy & web cache with NGINX, HAProxy and VarnishReverse proxy & web cache with NGINX, HAProxy and Varnish
Reverse proxy & web cache with NGINX, HAProxy and VarnishEl Mahdi Benzekri
 
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다Arawn Park
 
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014Claus Ibsen
 
The Service Mesh: It's about Traffic
The Service Mesh: It's about TrafficThe Service Mesh: It's about Traffic
The Service Mesh: It's about TrafficC4Media
 
Spring IO 2023 - Dynamic OpenAPIs with Spring Cloud Gateway
Spring IO 2023 - Dynamic OpenAPIs with Spring Cloud GatewaySpring IO 2023 - Dynamic OpenAPIs with Spring Cloud Gateway
Spring IO 2023 - Dynamic OpenAPIs with Spring Cloud GatewayIván López Martín
 
Spring cloud on kubernetes
Spring cloud on kubernetesSpring cloud on kubernetes
Spring cloud on kubernetesSangSun Park
 
2019-02-20-ddd taiwan-community-iddd-studygroup-1st
2019-02-20-ddd taiwan-community-iddd-studygroup-1st2019-02-20-ddd taiwan-community-iddd-studygroup-1st
2019-02-20-ddd taiwan-community-iddd-studygroup-1stKim Kao
 
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 1.13.0対応)
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 1.13.0対応)FIWARE Orion Context Broker コンテキスト情報管理 (Orion 1.13.0対応)
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 1.13.0対応)fisuda
 
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드confluent
 
Service mesh(istio) monitoring
Service mesh(istio) monitoringService mesh(istio) monitoring
Service mesh(istio) monitoringJeong-Ho Na
 
HAProxy TCP 모드에서 내부 서버로 Source IP 전달 방법
HAProxy TCP 모드에서 내부 서버로 Source IP 전달 방법HAProxy TCP 모드에서 내부 서버로 Source IP 전달 방법
HAProxy TCP 모드에서 내부 서버로 Source IP 전달 방법Young D
 
Ch02 撰寫與設定Servlet
Ch02 撰寫與設定ServletCh02 撰寫與設定Servlet
Ch02 撰寫與設定ServletJustin Lin
 
Rancher Simple User Guide
Rancher Simple User GuideRancher Simple User Guide
Rancher Simple User GuideSANG WON PARK
 
클라우드의 대세 쿠버네티스란 무엇인가?(윤성훈 클라우드 솔루션 아키텍트) - Webinar
클라우드의 대세 쿠버네티스란 무엇인가?(윤성훈 클라우드 솔루션 아키텍트) - Webinar클라우드의 대세 쿠버네티스란 무엇인가?(윤성훈 클라우드 솔루션 아키텍트) - Webinar
클라우드의 대세 쿠버네티스란 무엇인가?(윤성훈 클라우드 솔루션 아키텍트) - WebinarNAVER CLOUD PLATFORMㅣ네이버 클라우드 플랫폼
 

What's hot (20)

Delivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWSDelivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWS
 
Load-testing 101 for Startups with Artillery.io
Load-testing 101 for Startups with Artillery.ioLoad-testing 101 for Startups with Artillery.io
Load-testing 101 for Startups with Artillery.io
 
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
 
멀티클라우드 Service Mesh
멀티클라우드 Service Mesh멀티클라우드 Service Mesh
멀티클라우드 Service Mesh
 
Demystifying Service Mesh
Demystifying Service MeshDemystifying Service Mesh
Demystifying Service Mesh
 
오픈스택 커뮤니티 소개 및 기술 동향
오픈스택 커뮤니티 소개 및 기술 동향오픈스택 커뮤니티 소개 및 기술 동향
오픈스택 커뮤니티 소개 및 기술 동향
 
Reverse proxy & web cache with NGINX, HAProxy and Varnish
Reverse proxy & web cache with NGINX, HAProxy and VarnishReverse proxy & web cache with NGINX, HAProxy and Varnish
Reverse proxy & web cache with NGINX, HAProxy and Varnish
 
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
 
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
 
The Service Mesh: It's about Traffic
The Service Mesh: It's about TrafficThe Service Mesh: It's about Traffic
The Service Mesh: It's about Traffic
 
Spring IO 2023 - Dynamic OpenAPIs with Spring Cloud Gateway
Spring IO 2023 - Dynamic OpenAPIs with Spring Cloud GatewaySpring IO 2023 - Dynamic OpenAPIs with Spring Cloud Gateway
Spring IO 2023 - Dynamic OpenAPIs with Spring Cloud Gateway
 
Spring cloud on kubernetes
Spring cloud on kubernetesSpring cloud on kubernetes
Spring cloud on kubernetes
 
2019-02-20-ddd taiwan-community-iddd-studygroup-1st
2019-02-20-ddd taiwan-community-iddd-studygroup-1st2019-02-20-ddd taiwan-community-iddd-studygroup-1st
2019-02-20-ddd taiwan-community-iddd-studygroup-1st
 
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 1.13.0対応)
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 1.13.0対応)FIWARE Orion Context Broker コンテキスト情報管理 (Orion 1.13.0対応)
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 1.13.0対応)
 
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
 
Service mesh(istio) monitoring
Service mesh(istio) monitoringService mesh(istio) monitoring
Service mesh(istio) monitoring
 
HAProxy TCP 모드에서 내부 서버로 Source IP 전달 방법
HAProxy TCP 모드에서 내부 서버로 Source IP 전달 방법HAProxy TCP 모드에서 내부 서버로 Source IP 전달 방법
HAProxy TCP 모드에서 내부 서버로 Source IP 전달 방법
 
Ch02 撰寫與設定Servlet
Ch02 撰寫與設定ServletCh02 撰寫與設定Servlet
Ch02 撰寫與設定Servlet
 
Rancher Simple User Guide
Rancher Simple User GuideRancher Simple User Guide
Rancher Simple User Guide
 
클라우드의 대세 쿠버네티스란 무엇인가?(윤성훈 클라우드 솔루션 아키텍트) - Webinar
클라우드의 대세 쿠버네티스란 무엇인가?(윤성훈 클라우드 솔루션 아키텍트) - Webinar클라우드의 대세 쿠버네티스란 무엇인가?(윤성훈 클라우드 솔루션 아키텍트) - Webinar
클라우드의 대세 쿠버네티스란 무엇인가?(윤성훈 클라우드 솔루션 아키텍트) - Webinar
 

Similar to A very simple hexagonal architecture.pdf

Resume_8years-Exp_Embedded
Resume_8years-Exp_EmbeddedResume_8years-Exp_Embedded
Resume_8years-Exp_EmbeddedVijayraj Hada
 
RAD Studio XE7 Tour Live Online - Move your VCL Into the Future
RAD Studio XE7 Tour Live Online - Move your VCL Into the FutureRAD Studio XE7 Tour Live Online - Move your VCL Into the Future
RAD Studio XE7 Tour Live Online - Move your VCL Into the FutureDavid Intersimone
 
UplinQ - qualcomm® hexagon™ sdk optimize your multimedia solutions
UplinQ - qualcomm® hexagon™ sdk optimize your multimedia solutionsUplinQ - qualcomm® hexagon™ sdk optimize your multimedia solutions
UplinQ - qualcomm® hexagon™ sdk optimize your multimedia solutionsSatya Harish
 
Qualcomm Hexagon SDK: Optimize Your Multimedia Solutions
Qualcomm Hexagon SDK: Optimize Your Multimedia SolutionsQualcomm Hexagon SDK: Optimize Your Multimedia Solutions
Qualcomm Hexagon SDK: Optimize Your Multimedia SolutionsQualcomm Developer Network
 
Crossing the low-code and pro-code chasm: a platform approach
Crossing the low-code and pro-code chasm: a platform approachCrossing the low-code and pro-code chasm: a platform approach
Crossing the low-code and pro-code chasm: a platform approachAsanka Abeysinghe
 
INTERFACE, by apidays - Crossing the low-code and pro-code chasm: a platform...
INTERFACE, by apidays  - Crossing the low-code and pro-code chasm: a platform...INTERFACE, by apidays  - Crossing the low-code and pro-code chasm: a platform...
INTERFACE, by apidays - Crossing the low-code and pro-code chasm: a platform...apidays
 
Seattle Cassandra Users: An OSS Java Abstraction Layer for Cassandra
Seattle Cassandra Users: An OSS Java Abstraction Layer for CassandraSeattle Cassandra Users: An OSS Java Abstraction Layer for Cassandra
Seattle Cassandra Users: An OSS Java Abstraction Layer for CassandraJosh Turner
 
How to Store and Visualize CAN Bus Telematic Data with InfluxDB Cloud and Gra...
How to Store and Visualize CAN Bus Telematic Data with InfluxDB Cloud and Gra...How to Store and Visualize CAN Bus Telematic Data with InfluxDB Cloud and Gra...
How to Store and Visualize CAN Bus Telematic Data with InfluxDB Cloud and Gra...InfluxData
 
HARISH_Resume_Embedded_SW
HARISH_Resume_Embedded_SWHARISH_Resume_Embedded_SW
HARISH_Resume_Embedded_SWHarish Kumar S
 
From Legacy to DDD in PHP | Tech Talks | Privalia
From Legacy to DDD in PHP | Tech Talks | PrivaliaFrom Legacy to DDD in PHP | Tech Talks | Privalia
From Legacy to DDD in PHP | Tech Talks | PrivaliaJordi Vila Gallardo
 
LAS16 100 K1 - Keynote George Grey
LAS16 100 K1 - Keynote George GreyLAS16 100 K1 - Keynote George Grey
LAS16 100 K1 - Keynote George Grey96Boards
 
LAS16-100K1: Welcome Keynote
LAS16-100K1: Welcome KeynoteLAS16-100K1: Welcome Keynote
LAS16-100K1: Welcome KeynoteLinaro
 
Technical Architect on Embedded System.
Technical Architect on Embedded System.Technical Architect on Embedded System.
Technical Architect on Embedded System.Prasad Roy Raju
 
Designing Machine-level HMI with Studio 5000 View Designer® Demonstration
Designing Machine-level HMI with Studio 5000 View Designer® DemonstrationDesigning Machine-level HMI with Studio 5000 View Designer® Demonstration
Designing Machine-level HMI with Studio 5000 View Designer® DemonstrationRockwell Automation
 
Brocade Software Networking (SDN NFV Day ITB 2016)
Brocade Software Networking (SDN NFV Day ITB 2016)Brocade Software Networking (SDN NFV Day ITB 2016)
Brocade Software Networking (SDN NFV Day ITB 2016)SDNRG ITB
 
Overview of asp .net
Overview of asp .netOverview of asp .net
Overview of asp .netSajan Sahu
 

Similar to A very simple hexagonal architecture.pdf (20)

Resume_8years-Exp_Embedded
Resume_8years-Exp_EmbeddedResume_8years-Exp_Embedded
Resume_8years-Exp_Embedded
 
RAD Studio XE7 Tour Live Online - Move your VCL Into the Future
RAD Studio XE7 Tour Live Online - Move your VCL Into the FutureRAD Studio XE7 Tour Live Online - Move your VCL Into the Future
RAD Studio XE7 Tour Live Online - Move your VCL Into the Future
 
UplinQ - qualcomm® hexagon™ sdk optimize your multimedia solutions
UplinQ - qualcomm® hexagon™ sdk optimize your multimedia solutionsUplinQ - qualcomm® hexagon™ sdk optimize your multimedia solutions
UplinQ - qualcomm® hexagon™ sdk optimize your multimedia solutions
 
Qualcomm Hexagon SDK: Optimize Your Multimedia Solutions
Qualcomm Hexagon SDK: Optimize Your Multimedia SolutionsQualcomm Hexagon SDK: Optimize Your Multimedia Solutions
Qualcomm Hexagon SDK: Optimize Your Multimedia Solutions
 
sampath_kumar
sampath_kumarsampath_kumar
sampath_kumar
 
Crossing the low-code and pro-code chasm: a platform approach
Crossing the low-code and pro-code chasm: a platform approachCrossing the low-code and pro-code chasm: a platform approach
Crossing the low-code and pro-code chasm: a platform approach
 
INTERFACE, by apidays - Crossing the low-code and pro-code chasm: a platform...
INTERFACE, by apidays  - Crossing the low-code and pro-code chasm: a platform...INTERFACE, by apidays  - Crossing the low-code and pro-code chasm: a platform...
INTERFACE, by apidays - Crossing the low-code and pro-code chasm: a platform...
 
Dreambox caMip
Dreambox caMipDreambox caMip
Dreambox caMip
 
Sa*ple
Sa*pleSa*ple
Sa*ple
 
Seattle Cassandra Users: An OSS Java Abstraction Layer for Cassandra
Seattle Cassandra Users: An OSS Java Abstraction Layer for CassandraSeattle Cassandra Users: An OSS Java Abstraction Layer for Cassandra
Seattle Cassandra Users: An OSS Java Abstraction Layer for Cassandra
 
How to Store and Visualize CAN Bus Telematic Data with InfluxDB Cloud and Gra...
How to Store and Visualize CAN Bus Telematic Data with InfluxDB Cloud and Gra...How to Store and Visualize CAN Bus Telematic Data with InfluxDB Cloud and Gra...
How to Store and Visualize CAN Bus Telematic Data with InfluxDB Cloud and Gra...
 
HARISH_Resume_Embedded_SW
HARISH_Resume_Embedded_SWHARISH_Resume_Embedded_SW
HARISH_Resume_Embedded_SW
 
From Legacy to DDD in PHP | Tech Talks | Privalia
From Legacy to DDD in PHP | Tech Talks | PrivaliaFrom Legacy to DDD in PHP | Tech Talks | Privalia
From Legacy to DDD in PHP | Tech Talks | Privalia
 
LAS16 100 K1 - Keynote George Grey
LAS16 100 K1 - Keynote George GreyLAS16 100 K1 - Keynote George Grey
LAS16 100 K1 - Keynote George Grey
 
LAS16-100K1: Welcome Keynote
LAS16-100K1: Welcome KeynoteLAS16-100K1: Welcome Keynote
LAS16-100K1: Welcome Keynote
 
Technical Architect on Embedded System.
Technical Architect on Embedded System.Technical Architect on Embedded System.
Technical Architect on Embedded System.
 
Designing Machine-level HMI with Studio 5000 View Designer® Demonstration
Designing Machine-level HMI with Studio 5000 View Designer® DemonstrationDesigning Machine-level HMI with Studio 5000 View Designer® Demonstration
Designing Machine-level HMI with Studio 5000 View Designer® Demonstration
 
KIRANKUMAR_MV
KIRANKUMAR_MVKIRANKUMAR_MV
KIRANKUMAR_MV
 
Brocade Software Networking (SDN NFV Day ITB 2016)
Brocade Software Networking (SDN NFV Day ITB 2016)Brocade Software Networking (SDN NFV Day ITB 2016)
Brocade Software Networking (SDN NFV Day ITB 2016)
 
Overview of asp .net
Overview of asp .netOverview of asp .net
Overview of asp .net
 

Recently uploaded

VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLManishPatel169454
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 

Recently uploaded (20)

(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 

A very simple hexagonal architecture.pdf

  • 1. A very simple hexagonal architecture implementation in java Dan MAGIER 1
  • 2. 2
  • 3. 3 Dan Magier CEO +33683224954 dan@heiwa-it.com www.heiwa-it.com Adresse - Paris - France Dan Magier CEO +33683224954 dan@heiwa-it.com www.heiwa-it.com Adresse - Paris - France https://www.linkedin.com/in/dan-magier-67a9374/ @MagierDan dan@heiwa-it.com
  • 5. HEXAGONAL ARCHITECTURE GOAL(S) Main goal Separate the domain code from the technical code 5
  • 6. HEXAGONAL ARCHITECTURE GOAL(S) Sub goals 1. De fi ne a Domain Speci fi c Language (DSL) 6
  • 7. HEXAGONAL ARCHITECTURE GOAL(S) Sub goals 1. De fi ne a Domain Speci fi c Language (DSL) 2. Switch easily between technologies without changing domain code 7
  • 9. HEXAGONAL ARCHITECTURE COMPONENTS ➤ A hexagon representing the domain Create your DSL with all the people involved on the project if possible (BIZ, DEV and QA) Domain code 9
  • 10. HEXAGONAL ARCHITECTURE COMPONENTS 10 The domain represented by a java maven module here
  • 11. HEXAGONAL ARCHITECTURE COMPONENTS 11 The Domain Specific Language
  • 12. HEXAGONAL ARCHITECTURE COMPONENTS ➤ A hexagon representing the domain ➤ The ports provided by the hexagon A port represent the intention of the dialog Don’t think of it as (only) a technical part (as a Java interface for instance) « This is for …ing" Domain code : port 12
  • 13. HEXAGONAL ARCHITECTURE COMPONENTS 13 Ports can be represented in Java by an interface
  • 14. HEXAGONAL ARCHITECTURE COMPONENTS ➤ A hexagon representing the domain ➤ The ports provided by the hexagon ➤ The adapters containing the technical code The domain is sel fi sh. It speaks only its own language with the infrastructure 14
  • 15. HEXAGONAL ARCHITECTURE COMPONENTS 15 An adapter implementing the intention of the previous port
  • 16. HEXAGONAL ARCHITECTURE COMPONENTS Oracle DB Adapter (Technical code) Web Interface Infrastructure providing data to the domain Infrastructure consuming data from the domain Adapter (Technical code) Domain code : port 16
  • 17. HEXAGONAL ARCHITECTURE OTHERS ELEMENTS ➤ To the left of the hexagon, we have the primary actors, the one who trigger the system, composed of drivers (cause the application to take action) ➤ To the right of the hexagon, we have the secondary actor, the one triggered, composed of recipients (get noti fi ed by the application) and repositories (provide data to the application) 17
  • 19. THE BENEFITS Separation of concerns The domain code is « completely » independent of the infrastructure code: ➤ avoid to mix domain and technical code ➤ Ease the technology watch 19
  • 20. THE BENEFITS ➤ Separation of concerns ➤ Domain centric language via the DSL => DDD 20
  • 21. THE BENEFITS ➤ Separation of concerns ➤ Domain centric language via the DSL => DDD ➤ Testing ( fi rst) easily with or without having the physical infrastructure 21
  • 22. THE BENEFITS ➤ Separation of concerns ➤ Domain centric language via the DSL => DDD ➤ Testing easily without having the physical infrastructure ➤ Easy to implements another adapter for a new technology => change technology easily without changing domain code : oracle adapter to mongodb adapter 22
  • 23. HEXAGONAL ARCHITECTURE REPRESENTATION Domain code Oracle DB Mongo DB Adapter (Technical code) Adapter (Technical code) 23 Multiple adapters for one port without changing domain code : port
  • 24. HOW DO WE DO IT ? 24
  • 25. HOW DO WE DO IT ? Dependency Inversion - High-level modules should not depend on low-level modules. Both should depend on abstractions. - Abstractions should not depend on details. Details should depend on abstractions. 25
  • 26. HOW DO WE DO IT ? 26 Dependency Inversion: The intention defined by the high level component (Domain)
  • 27. HOW DO WE DO IT ? 27 Dependency Inversion: The low level component (Infrastructure) respecting the previous intention
  • 28. HOW DO WE DO IT ? Dependency Injection (Con fi gurable dependency) In software engineering, dependency injection is a technique whereby one object supplies the dependencies of another object. A dependency is an object that can be used (a service). An injection is the passing of a dependency to a dependent object (a client) that would use it.  28
  • 29. HOW DO WE DO IT ? 29 Dependency Injection: Constructor injection in the present example in the Domain
  • 30. HOW DO WE DO IT ? 30 Dependency Injection: Constructor injection in the present example in the Driver Infrastructure
  • 31. HOW DO WE DO IT ? It’s just common sense Just di ff erentiate what’s part of the domain and what’s part of the infrastructure Beware to not create object mixing domain and technical part 31
  • 33. HEXAGONAL ARCHITECTURE COMPONENTS Oracle DB Adapter (Technical code) Web Interface Infrastructure providing data to the domain Infrastructure consuming data from the domain Adapter (Technical code) Domain code 33 : port
  • 34. CONCLUSION ➤ Separate the domain and the infrastructure parts 34
  • 35. CONCLUSION ➤ Separate the domain and the infrastructure parts ➤ Involve, if possible, all the team member to de fi ne your Domain language 35
  • 36. CONCLUSION ➤ Separate the domain and the infrastructure parts ➤ Involve, if possible, all the team member to de fi ne your Domain language ➤ The domain is sel fi sh. It speaks only with its language with the infrastructure 36
  • 37. CONCLUSION ➤ Separate the domain and the infrastructure parts ➤ Involve, if possible, all the team member to de fi ne your Domain language ➤ The domain is sel fi sh. It speaks only with its language with the infrastructure ➤ Do not create objects mixing domain and infrastructure parts 37
  • 38. CONCLUSION ➤ Separate the domain and the infrastructure parts ➤ Involve, if possible, all the team member to de fi ne your Domain language ➤ The domain is sel fi sh. It speaks only with its language with the infrastructure ➤ Do not create objects between domain and infrastructure parts ➤ It’s a real thing ^^ 38
  • 39. It’s a very simple architecture Just do it ;-) 39
  • 42. IT’S NOT FINISHED! YOUR TURN ^^ https://github.com/HEIWA-IT/trippricer-workshop 42