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
July 07, 2016
Programming
4
680
Fundamental Domain-Driven Design For Microservices
Slides of the talk I gave at Java Forum Stuttgart 2016.
#jfs2016 @springcentral
Oliver Drotbohm
July 07, 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
720
Bottom-Up Architecture – Bridging the Achitecture Code Gap
olivergierke
4
950
Spring Modulith – A Deep Dive
olivergierke
8
4.5k
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.9k
A Deep Dive into Spring Application Events
olivergierke
12
3.3k
Building Better Monoliths – Modulithic Applications with Spring Boot
olivergierke
4
970
Spring HATEOAS – Hypermedia APIs with Spring
olivergierke
1
750
Other Decks in Programming
See All in Programming
AIを活用し、今後に備えるための技術知識 / Basic Knowledge to Utilize AI
kishida
20
4.9k
Updates on MLS on Ruby (and maybe more)
sylph01
1
180
奥深くて厄介な「改行」と仲良くなる20分
oguemon
1
420
Oracle Database Technology Night 92 Database Connection control FAN-AC
oracle4engineer
PRO
1
400
DockerからECSへ 〜 AWSの海に出る前に知っておきたいこと 〜
ota1022
5
1.9k
「待たせ上手」なスケルトンスクリーン、 そのUXの裏側
teamlab
PRO
0
240
時間軸から考えるTerraformを使う理由と留意点
fufuhu
14
4.3k
AIでLINEスタンプを作ってみた
eycjur
1
220
react-callを使ってダイヤログをいろんなとこで再利用しよう!
shinaps
1
150
Microsoft Orleans, Daprのアクターモデルを使い効率的に開発、デプロイを行うためのSekibanの試行錯誤 / Sekiban: Exploring Efficient Development and Deployment with Microsoft Orleans and Dapr Actor Models
tomohisa
0
230
CSC305 Summer Lecture 12
javiergs
PRO
0
130
Claude Codeで挑むOSSコントリビュート
eycjur
0
190
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
74
5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
111
20k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
It's Worth the Effort
3n
187
28k
The Cult of Friendly URLs
andyhume
79
6.6k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
How to Ace a Technical Interview
jacobian
279
23k
Scaling GitHub
holman
463
140k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.5k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
How GitHub (no longer) Works
holman
315
140k
The Invisible Side of Design
smashingmag
301
51k
Transcript
© 2014 SpringOne 2GX. All rights reserved. Do not distribute
without permission. DOMAIN-DRIVEN DESIGN / OLIVERGIERKE ƻ
[email protected]
FUNDAMENTAL FOR MICROSERVICES
2
None
4 http://www.infoq.com/minibooks/domain-driven-design-quickly
Microservices ♥ Domain-Driven Design 5 11:10 — Beethoven Saal
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.
Entities & Aggregates 17
18 Order LineItem Product Invoice Customer Payment Address Email
18 Order LineItem Product Invoice Customer Payment Address Email
Persistence technology VS. Domain model 19
Aggregate = Entity + Repository 20
21 Order LineItem Product Invoice Customer Payment Address Email
Bounded Context 22
Order LineItem Product Invoice Customer Payment Address
24 Shipping Accounting Catalog Orders User Registration
24 Shipping Accounting Catalog Orders User Registration Accounting Payment information
Billing Address Shipping Shipping address Customer Product
Domain-Driven Design & Monoliths 25
Avoid technologies that get in your way. 26
How to enforce context boundaries? 27
What about consistency? 28
References between Bounded Contexts? 29
Domain Events 30
31 Level 0: No events at all
31 Level 0: No events at all Level 1: Explicit
operations
If you’re calling two setters in a row, you’re missing
a concept. 32
33 Level 0: No events at all Level 1: Explicit
operations Level 2: Some operations as events
State transitions become domain events. 34
35 Level 0: No events at all Level 1: Explicit
operations Level 2: Some operations as events Level 3: Event Sourcing
Domain-Driven Design & Microservices 36
Bounded contexts define system boundaries. 37
38 Shipping Accounting Catalog Orders User Registration Accounting Payment information
Billing Address Shipping Shipping address Customer Product
39 Shipping Accounting Catalog Orders User Registration Accounting Shipping
40 Shipping Accounting Catalog Orders User Registration Accounting Shipping HTTP
Messaging
Architecture is less likely to deteriorate as it’s harder to
violate boundaries. 41
Restructuring service boundaries is much harder. 42
Inter-Service communication becomes remote communication. 43
Accept and embrace eventual consistency between services. 44
Domain Events 45
REST & Messaging 46
Domain events become state transitions. 47
Hypermedia for state transition and explicit events. 48
Thanks! 49