Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Fundamental Domain-Driven Design For Microservices
Search
Oliver Drotbohm
April 19, 2016
Programming
11
1.1k
Fundamental Domain-Driven Design For Microservices
Slides of the talk I gave at JAX 2016, Mayence.
@springcentral
Oliver Drotbohm
April 19, 2016
Tweet
Share
More Decks by Oliver Drotbohm
See All by Oliver Drotbohm
It Takes Two to Tango – Designing Module Interactions in Modulithic Spring Applications
olivergierke
5
630
Bottom-Up Architecture – Bridging the Achitecture Code Gap
olivergierke
4
870
Spring Modulith – A Deep Dive
olivergierke
8
4.2k
Spring for the Architecturally Curious Developer
olivergierke
5
1.8k
Spring Boot 3 & Spring Framework 6
olivergierke
4
2k
Architecturally-evident Java Applications with jMolecules
olivergierke
9
2.8k
A Deep Dive into Spring Application Events
olivergierke
12
3.2k
Building Better Monoliths – Modulithic Applications with Spring Boot
olivergierke
4
940
Spring HATEOAS – Hypermedia APIs with Spring
olivergierke
1
730
Other Decks in Programming
See All in Programming
AIコーディングの理想と現実
tomohisa
35
37k
エンジニアが挑む、限界までの越境
nealle
1
310
AIコーディングエージェントを 「使いこなす」ための実践知と現在地 in ログラス / How to Use AI Coding Agent in Loglass
rkaga
4
1.2k
The Implementations of Advanced LR Parser Algorithm
junk0612
1
1.3k
Enterprise Web App. Development (1): Build Tool Training Ver. 5
knakagawa
1
120
Dissecting and Reconstructing Ruby Syntactic Structures
ydah
3
2k
2025-04-25 GitHub Copilot Agent ライブデモ(スクリプト)
goataka
0
100
generative-ai-use-cases(GenU)の推しポイント ~2025年4月版~
hideg
1
370
Road to RubyKaigi: Making Tinny Chiptunes with Ruby
makicamel
4
540
Fiber Scheduler vs. General-Purpose Parallel Client
hayaokimura
1
290
設計の本質:コード、システム、そして組織へ / The Essence of Design: To Code, Systems, and Organizations
nrslib
10
3.7k
Orleans + Sekiban + SignalR でリアルタイムWeb作ってみた
tomohisa
0
230
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
BBQ
matthewcrist
88
9.6k
Raft: Consensus for Rubyists
vanstee
137
6.9k
The Pragmatic Product Professional
lauravandoore
33
6.6k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Six Lessons from altMBA
skipperchong
28
3.7k
Git: the NoSQL Database
bkeepers
PRO
430
65k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.5k
The World Runs on Bad Software
bkeepers
PRO
68
11k
Side Projects
sachag
453
42k
Rails Girls Zürich Keynote
gr2m
94
13k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Transcript
© 2014 SpringOne 2GX. All rights reserved. Do not distribute
without permission. DOMAIN-DRIVEN DESIGN / OLIVERGIERKE ƻ
[email protected]
GRUNDLEGENDES FÜR MICROSERVICES
2
None
4 http://www.infoq.com/minibooks/domain-driven-design-quickly
Microservices ♥ Domain-Driven Design 5 Slides and video by Michael
Plöd.
6
6
Implementing Domain-Driven Design 7
Value objects 8
Stringly typed code 9 public class Customer { private Long
id; private String firstname, lastname, email; … }
Stringly typed code 10 public class SomeService { public void
createUser(String firstname, String lastname, String email) { … } }
11 public class Customer { private Long id; private Firstname
firstname; private Lastname lastname; private EmailAddress emailAddress; … }
Value Objects are a PITA to build in some languages.
12
Still, they’re worth it. 13 See „Power Use of Value
Objects in DDD“ by Dan Bergh Johnsson.
Lombok — putting the spice back into Java. 14
15 @Value public class Customer { UUID id = UUID.randomUUID();
Firstname firstname; Lastname lastname; EmailAddress email; @Value static class EmailAddress { String value; } }
AutoValue 16 Project website on GitHub.
Key opponents: Mapping libraries that need to (de)serialize them. 17
Entities & Aggregates 18
Persistence technology VS. Domain model 19
Challenges with JPA: Value objects as @Entity Flat relationships
20
21 Order LineItem Product Invoice Customer Payment Address Email
21 Order LineItem Product Invoice Customer Payment Address Email
Repositories turn an entity into an aggregate root. 22
23 Order LineItem Product Invoice Customer Payment Address Email
Bounded Context 24
Order LineItem Product Invoice Customer Payment Address
26 Shipping Accounting Catalog Orders User Registration
26 Shipping Accounting Catalog Orders User Registration Accounting Payment information
Billing Address Shipping Shipping address Customer
26 Shipping Accounting Catalog Orders User Registration Accounting Payment information
Billing Address Shipping Shipping address Customer Product
Domain-Driven Design & Monoliths 27
Avoid technologies that get in your way. 28
How to enforce context boundaries? 29
What about consistency? 30
References between Bounded Contexts? 31
Domain Events 32
33 Level 0: No events at all
33 Level 0: No events at all Level 1: Explicit
operations
If you’re calling two setters in a row, you’re missing
a concept. 34
35 Level 0: No events at all Level 1: Explicit
operations
35 Level 0: No events at all Level 1: Explicit
operations Level 2: Some operations as events
State transitions become domain events. 36
37 Level 0: No events at all Level 1: Explicit
operations Level 2: Some operations as events
37 Level 0: No events at all Level 1: Explicit
operations Level 2: Some operations as events Level 3: Event Sourcing
Domain-Driven Design & Microservices 38
Bounded contexts define system boundaries. 39
40 Shipping Accounting Catalog Orders User Registration Accounting Payment information
Billing Address Shipping Shipping address Customer Product
41 Shipping Accounting Catalog Orders User Registration Accounting Shipping
42 Shipping Accounting Catalog Orders User Registration Accounting Shipping HTTP
Messaging
Architecture is less likely to deteriorate as it’s harder to
violate boundaries. 43
Restructuring service boundaries is much harder. 44
Inter-Service communication becomes remote communication. 45
Accept and embrace eventual consistency between services. 46
Domain Events 47
REST & Messaging 48
Domain events become state transitions. 49
Hypermedia for state transition and explicit events. 50
Thanks! 51