Découvrez en pratique l'architecture hexagonale, indispensable pour vos applications complexes !
Ce style d'architecture permet d'adapter votre code à tout changement de technologie sans souffrir. Si vous aimez changer de frameworks ou de librairies, tester correctement ou appliquer le Domain-Driven Design, alors vous avez besoin d'architecture hexagonale !
Avec des exemples en code Java, et au travers d’un kata d’architecture auquel vous pourrez participer, nous vous montrerons les pièges à éviter et comment mettre en œuvre ce pattern sans trop galérer, et ce dès votre retour au bureau !
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
Coder sans peur du changement avec la meme pas mal hexagonal architecture
1. @cyriux @tpierrain#MemePasMal
Coder sans peur du changement, avec la
"même pas mal !" architecture
hexagonale
Cyrille MARTRAIRE (@cyriux)
Arolla
!
Thomas PIERRAIN (@tpierrain)
Société Générale
2. @cyriux @tpierrain#MemePasMal
CODER
SANS
PEUR
DU
CHANGEMENT,
AVEC
LA
"MÊME
PAS
MAL
!"
ARCHITECTURE
HEXAGONALE
Cyrille MARTRAIRE (@cyriux)
Arolla
!
Thomas PIERRAIN (@tpierrain)
Société Générale
30. Scenario-Driven…
Given a sweets box of size XL
And a selection of 500g of M&Ms
And assuming the following prices
| item | price | currency |
| XL Box | 2.50 | EUR |
| M&M (100g)| 5.00 | EUR |
!
When I ask for a price
Then the price is 27.50 EUR
66. Main benefits
!
1.Focus on what really matters
(business value first!) ➔ have you ever tried DDD?
!
2.Choose the technology last
(when we know best our concrete needs)
!
3.Embrace the changes
(“Même pas mal !” / “that didn't hurt one bit“)
69. @cyriux @tpierrain#MemePasMal
CODER
SANS
PEUR
DU
CHANGEMENT,
AVEC
LA
"MÊME
PAS
MAL
!"
ARCHITECTURE
HEXAGONALE
Cyrille MARTRAIRE (@cyriux)
Arolla
!
Thomas PIERRAIN (@tpierrain)
Société Générale
93. +-----+-------------+----------+!
| gui | file system | database |!
|-----+-------------+----------+!
| domain |!
|------------------------------+
Infra the other way round!
Layering
http://matteo.vaccari.name/blog/archives/154
130. Un
service,
la
facade
coté
mé^er
d’un
stockage
!
Sans
jamais
parler
de
base
de
données.
Repository
h;p://www.andeka.co.cc/2011/07/postbox-‐251.html
141. Bounded Contexts
Il
n’est
pas
possible
de
convenir
du
sens
précis
des
mots
u7lisés
par
un
grand
nombre
de
personnes.
!
Il
faut
accepter
ce
fait,
et
donc
définir dans quel
contexte
un
langage
est
clairement
défini
sans
ambiguité.
147. Wrap-up
• Concepts & Messages
– Subir -> Délibéré
– Intérieur Vs Extérieur
– Gérer ses dépendances
– Langage interne / externe
– DIP
• Exemples
• Kata
148. Content
• When not to go Hexagonal?
– Conformist
– Facebook game
– Too small (connector…)
!
• Advanced aspects
– The adapter pattern
– Tech ports diversity
– 1 Adapter – many interfaces
– 1 interface – many adapters
– Data push
– Session management
– Adapter as a module indeed
149. Content 2
Domain model as a Pure
Functions (100% no Entity
inside) vs as Aggregates
!
--
The Repository pattern
Reuse slides
Hexagonal for a Bubble
Context within a legacy
!
Ports = surrounding legacy
Adapters = repository /
adapter
!
Cloakroom / clandestine
passenger patterns
150. Content 3
How to enforce?
!
Discipline
Maven multi modules, .Net projects
Static analysis: JDepend rules, NDepend,
Sonar plugins
—
Bounded Context
Reuse slides
!
Conformist vs ACL isolation
Same language or not?
!
Autonomous Components / Polyglot
persistence
!
Influence of sync vs async / push vs pull on
the inside of the hexagon
!
Examples?
Living Documentation
Convention (YES)? Annotation on
packages?
!
The Bounded Contexts / the
Domain models vs the rest (ici un
seul Bounded Context)
!
Domain model -> inside
Everything else
- that implements something from
the domain model -> at the right
- everything else that only calls -
> at the left
!
155. http://matteo.vaccari.name/blog/archives/154
Problem: write a program that
1.
Loads
a
set
of
employee
records
from
a
flat
file
2.
Sends
a
greetings
email
to
all
employees
whose
birthday
is
today
!
The
flat
file
is
a
sequence
of
records,
separated
by
newlines;
this
are
the
first
few
lines:
last_name, first_name, date_of_birth, email !
Doe, John, 1982/10/08, john.doe@foobar.com !
Ann, Mary, 1975/09/11, mary.ann@foobar.com !
The
greetings
email
contains
the
following
text:
Subject:
Happy
birthday!
Happy
birthday,
dear
John!
with
the
first
name
of
the
employee
substituted
for
“John”
!
3.
REST
service
to
query
past
greetings
!
HINT:
today
is
a
tech
port!
!
!
+-----+-------------+----------+!
| gui | file system | database |!
|-----+-------------+----------+!
| domain |!
|------------------------------+
+--------------+!
| presentation |!
|--------------|!
| domain |!
|--------------|!
| persistence |!
+--------------+
Exercise
Postgres Sql + Gui (+ myBatis ?)
Audit et log dans le domain
+ Metrics