SlideShare a Scribd company logo
BEYOND HEXAGONAL ARCHITECTURE
Thomas PIERRAIN
@tpierrain
Bruno BOUCARD
@brunoboucard
OUR DOMAIN
La Colline Théâtre National - Les Souffleurs d'Images
SUGGESTING SEATS IN THEATERS
“What seats can you suggest for 3
people wishing to attend the show Z?”
SEATS SUGGESTIONS API
SUGGESTING SEATS IN THEATERS
“What seats can you suggest for 3
people wishing to attend the show Z?”
AUDITORIUM SEATING
API
“I need the
auditorium seating
of show Z”
SEATS SUGGESTIONS API
SUGGESTING SEATS IN THEATERS
“What seats can you suggest for 3
people wishing to attend the show Z?”
AUDITORIUM SEATING
API
“I need the
auditorium seating
of show Z”
SEATS SUGGESTIONS API
SUGGESTING SEATS IN THEATERS
“What seats can you suggest for 3
people wishing to attend the show Z?”
AUDITORIUM SEATING
API
“I need the
auditorium seating
of show Z”
SEATS SUGGESTIONS API
SUGGESTING SEATS IN THEATERS
“What seats can you suggest for 3
people wishing to attend the show Z?”
AUDITORIUM SEATING
API
SEATS AVAILABILITY
API
“I need the
auditorium seating
of show Z”
SEATS SUGGESTIONS API
“I also need to know
which seats are
already reserved for
show Z”
SUGGESTING SEATS IN THEATERS
“What seats can you suggest for 3
people wishing to attend the show Z?”
AUDITORIUM SEATING
API
SEATS AVAILABILITY
API
“I need the
auditorium seating
of show Z”
SEATS SUGGESTIONS API
“I also need to know
which seats are
already reserved for
show Z”
SUGGESTING SEATS IN THEATERS
“What seats can you suggest for 3
people wishing to attend the show Z?”
AUDITORIUM SEATING
API
SEATS AVAILABILITY
API
“I need the
auditorium seating
of show Z”
SEATS SUGGESTIONS API
“I also need to know
which seats are
already reserved for
show Z”
OUR CORE DOMAIN
SUGGESTING SEATS IN THEATERS
“What seats can you suggest for 3
people wishing to attend the show Z?”
AUDITORIUM SEATING
API
SEATS AVAILABILITY
API
“I need the
auditorium seating
of show Z”
SEATS SUGGESTIONS API
“I also need to know
which seats are
already reserved for
show Z”
SUGGESTING SEATS IN THEATERS
“What seats can you suggest for 3
people wishing to attend the show Z?”
AUDITORIUM SEATING
API
SEATS AVAILABILITY
API
“I need the
auditorium seating
of show Z”
SEATS SUGGESTIONS API
“I also need to know
which seats are
already reserved for
show Z”
“Ok. You can have seats
A1, A2, A3 in pricing tier 1,
C4, C5, C6 in pricing tier 2
…”
SUGGESTING SEATS IN THEATERS
“What seats can you suggest for 3
people wishing to attend the show Z?”
AUDITORIUM SEATING
API
SEATS AVAILABILITY
API
“I need the
auditorium seating
of show Z”
SEATS SUGGESTIONS API
“I also need to know
which seats are
already reserved for
show Z”
“Ok. You can have seats
A1, A2, A3 in pricing tier 1,
C4, C5, C6 in pricing tier 2
…”
SUGGESTING SEATS IN THEATERS
“What seats can you suggest for 3
people wishing to attend the show Z?”
API ARCHITECTURE
(2 OPTIONS)
1.
OPTION 2 PRE-REQUISITE
Source: http://coder.efelti.com/2018/02/introduction-of-functional-programming.html
Source: http://coder.efelti.com/2018/02/introduction-of-functional-programming.html
2.
2.
HEXAGONAL IN MOTION
Beyond Hexagonal architecture
Beyond Hexagonal architecture
Beyond Hexagonal architecture
Beyond Hexagonal architecture
Beyond Hexagonal architecture
Beyond Hexagonal architecture
Beyond Hexagonal architecture
ANTI CORRUPTION LAYER
(ACL)
FUNCTIONAL CORE,
IMPERATIVE SHELL
IN MOTION
Beyond Hexagonal architecture
Beyond Hexagonal architecture
Beyond Hexagonal architecture
Beyond Hexagonal architecture
Beyond Hexagonal architecture
Beyond Hexagonal architecture
FROM HEXAGONAL TO
FUNCTIONAL CORE
(LIVE CODING)
(LIVE CODING)
MORE FUNCTIONAL?
https://blog.ploeh.dk/2018/03/26/the-maybe-functor/
MAYBE/OPTION
ILLUSTRATED
(LIVE CODE)
(LIVE CODE)
Makes decisions
Imperative Shell acts upon these decisions
FUNCTIONAL CORE – THEATER
HOW TO COPE WITH MULTIPLE I/O
IN SEQUENCE?
Beyond Hexagonal architecture
REMEMBER TRAIN-TRAIN?
REMEMBER TRAIN-TRAIN?
FUNCTIONAL CORE – TRAIN RESERVATION
(Imperative shell version)
FUNCTIONAL CORE – TRAIN RESERVATION
Call non-pure functions
(Imperative shell version)
FUNCTIONAL CORE – TRAIN RESERVATION
Call pure function - Make decisions
Call non-pure functions
(Imperative shell version)
FUNCTIONAL CORE – TRAIN RESERVATION
Call pure function - Make decisions
Acts upon these decisions
Call non-pure functions
(Imperative shell version)
TO SUM-UP
FEATURE
HEXAGONAL
ARCHITECTURE
FUNCTIONAL
ARCHITECTURE
Separate Infra from Business Yes “Yes”
Business Code without side effect
Business Decision are in Business part
Offers good ability to test
Technical concerns never leak from domain
HEXAGONAL OR FUNCTIONAL CORE?
FEATURE
HEXAGONAL
ARCHITECTURE
FUNCTIONAL
ARCHITECTURE
Separate Infra from Business Yes “Yes”
Business Code without side effect No* Yes
Business Decision are in Business part
Offers good ability to test
Technical concerns never leak from domain
HEXAGONAL OR FUNCTIONAL CORE?
FEATURE
HEXAGONAL
ARCHITECTURE
FUNCTIONAL
ARCHITECTURE
Separate Infra from Business Yes “Yes”
Business Code without side effect No* Yes
Business Decision are in Business part Yes “Yes”
Offers good ability to test
Technical concerns never leak from domain
HEXAGONAL OR FUNCTIONAL CORE?
FEATURE
HEXAGONAL
ARCHITECTURE
FUNCTIONAL
ARCHITECTURE
Separate Infra from Business Yes “Yes”
Business Code without side effect No* Yes
Business Decision are in Business part Yes “Yes”
Offers good ability to test Yes Yes
Technical concerns never leak from domain
HEXAGONAL OR FUNCTIONAL CORE?
FEATURE
HEXAGONAL
ARCHITECTURE
FUNCTIONAL
ARCHITECTURE
Separate Infra from Business Yes “Yes”
Business Code without side effect No* Yes
Business Decision are in Business part Yes “Yes”
Offers good ability to test Yes Yes
Technical concerns never leak from domain No Yes
HEXAGONAL OR FUNCTIONAL CORE?
Feature Hexagonal
Architecture
Functional
Architecture
Separate Infra from Business Yes “Yes”
Business Code without side effect No* Yes
Business Decision are in Business part Yes “Yes”
Offers good ability to test Yes Yes
Technical concerns never leak from domain No Yes
DOES IT MAKE SENSE
TO COMPARE THEM?!?
BTW…
Feature Hexagonal
Architecture
Functional
Architecture
Separate Infra from Business Yes “Yes”
Business Code without side effect No* Yes
Business Decision are in Business part Yes “Yes”
Offers good ability to test Yes Yes
Technical concerns never leak from domain No Yes
DOES IT MAKE SENSE TO COMPARE
CELERY AND CHOCOLATE?!?
BTW…
Feature Hexagonal
Architecture
Functional
Architecture
Separate Infra from Business Yes “Yes”
Business Code without side effect No* Yes
Business Decision are in Business part Yes “Yes”
Offers good ability to test Yes Yes
Technical concerns never leak from domain No Yes
DOES IT MAKE SENSE TO COMPARE 2 OPTIONS
RELATED TO 2 DIFFERENT PARADIGMS?
OK...
LAST BUT NOT LEAST…
”BEYOND” HEXAGONAL
ARCHITECTURE?!?
WE HAVE A QUESTION FOR YOU
HEXAGONAL OR NOT HEXAGONAL?
HEXAGONAL OR NOT HEXAGONAL?
-YES-
An Adapter can be an ACL
I may not want my domain to be
polluted by upstream organizational
changes
HEXAGONAL OR NOT HEXAGONAL?
-YES-
An Adapter can be an ACL
I may not want my domain to be
polluted by upstream organizational
changes
-NO-
I want to stick to Alistair original
motivations (i.e. technological)
 1 port-adapter per technology
HEXAGONAL OR NOT HEXAGONAL?
-YES-
It’s a multi-facets pattern!
o The technological facet
o The testability facet
o The tactical DDD facet
o The simplicity facet
o The quick feedback facet
o The late architectural
decisions facet
o The strategic DDD facet
HEXAGONAL OR NOT HEXAGONAL?
AND IF WE FINALLY VOTE NO…
o The technological facet
o The testability facet
o The tactical DDD facet
o The simplicity facet
o The quick feedback
facet
o The late architectural
decisions facet
o The strategic DDD facet
THE DDD COMMUNITY WILL
HAVE TO FIND NEW NAME(S)
FOR ALL OUR USAGES
THANK YOU!
SOME REFERENCES
THE MAYBE FUNCTOR - MARK SEEMANN
https://blog.ploeh.dk/2018/03/26/the-maybe-functor/
https://thinkbeforecoding.com/post/2018/01/25/functional-core
FUNCTIONAL CORE - JÉRÉMIE CHASSAING
https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell
FUNCTIONAL CORE, IMPERATIVE SHELL – GARY BERNHARDT
HEXAGONAL OR NOT HEXAGONAL? – THOMAS PIERRAIN
http://tpierrain.blogspot.com/2020/11/hexagonal-or-not-hexagonal.html

More Related Content

Beyond Hexagonal architecture