3. 01 What drives the software architecture?
• High Maintainability
• Low Technical Debt: The cost payed by bad decisions
• Lack of understanding
• Lack of tests
• Lack of documentation
• Lack of collaboration
• Lack of process
4. 01 Common multi-layer architecture
!
"
#
"
! UI Layer
" Application Layer
# Data
" Crosscutting
Dependency
8. 02 Intent
• Alternative names
• Ports & Adapters
• Onion Architecture / Onion Layers
“Allow an application to equally be driven by users,
programs, automated test or batch scripts, and to be
developed and tested in isolation from its eventual run-
time devices and databases.”
Alistair Cockburn
10. The big picture: Ports & Adapters02
"Application
Port Port
Port
Mock
DB
DB
Integration
Test
Agent
UI
Adapter
Adapter
Adapter
Adapter
Use Case
Boundary
‘’driven’’ adapters
‘’driver’’ adapters
11. Overview02
In-Memory
"Application
# Database
( Web Services
)
) Enterprise Integration
*
SQL Server
REST
Adapter
* Configuration
+
Test Agent
!
HTML5 App
Environment
Adapter
File Source
Adapter
,
SQL
Adapter
#
NoSQL
Adapter
- MQ Service
MQ
Adapter
.
. Messaging Queue
&ERP
CRM
DOCs
EI
Adapter
(SOAP
Adapter
TEST
Adapter
13. 03
• Organizing Concerns and Code with Domains
• Well defined boundaries between domains
• Simple event-driven components
• Life Preserver diagram
Life preserver approach by Russ Miles
19. Implementing the Use Case as Service05
• Domain model
• Entities
• Repositories
• Well defined interface
• Input/Output Events
• Event Handlers & Translators
• Service composition
• Unit Testing
22. Implementing passive controllers
• Dummy service invokers
• Do not perform multiple service calls
• It does not make any workflow decision
• REST Domain translator
0305
• UC
• Service
• Services
• Domain
• Controller
REST
Domain
06
27. Comments
• How many ports?
• The hexagon is a metaphor
• Abstractions
• Use Case as port
• Module as port: Notification, Administration,
Public API, Database
0303
• Services
28. See more…
• RESTful API with Spring Boot
• Securing REST APIs
• References:
[1] alistair.cockburn.us/Hexagonal+architecture
[2] www.infoq.com/news/2013/08/hexagonal-lifepreserver-spring
[3] github.com/russmiles/life-preserver-introductory-article-developer-magazine/
blob/master/README.md
[4] github.com/spring-guides/deprecate-tut-rest
[5] blog.ploeh.dk/2013/12/03/layers-onions-ports-adapters-its-all-the-same
/ fabricioepa.wordpress.com