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
September 30, 2016
Programming
2
580
Fundamental Domain-Driven Design for Microservices
Slides of the talk I gave at JUG Saxony Day 2016.
@springcentral
Oliver Drotbohm
September 30, 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
590
Bottom-Up Architecture – Bridging the Achitecture Code Gap
olivergierke
4
840
Spring Modulith – A Deep Dive
olivergierke
7
4.1k
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
8
2.8k
A Deep Dive into Spring Application Events
olivergierke
12
3.2k
Building Better Monoliths – Modulithic Applications with Spring Boot
olivergierke
4
910
Spring HATEOAS – Hypermedia APIs with Spring
olivergierke
1
700
Other Decks in Programming
See All in Programming
「個人開発マネタイズ大全」が教えてくれたこと
bani24884
1
190
プログラミング言語学習のススメ / why-do-i-learn-programming-language
yashi8484
0
160
AIプログラミング雑キャッチアップ
yuheinakasaka
17
4.2k
Flutter × Firebase Genkit で加速する生成 AI アプリ開発
coborinai
0
170
Rails アプリ地図考 Flush Cut
makicamel
1
130
Kotlinの開発でも AIをいい感じに使いたい / Making the Most of AI in Kotlin Development
kohii00
5
1.2k
Visual StudioのGitHub Copilotでいろいろやってみる
tomokusaba
1
210
15分で学ぶDuckDBの可愛い使い方 DuckDBの最近の更新
notrogue
3
500
パスキーのすべて ── 導入・UX設計・実装の紹介 / 20250213 パスキー開発者の集い
kuralab
3
890
ML.NETで始める機械学習
ymd65536
0
230
dbt Pythonモデルで実現するSnowflake活用術
trsnium
0
260
負債になりにくいCSSをデザイナとつくるには?
fsubal
10
2.6k
Featured
See All Featured
Statistics for Hackers
jakevdp
797
220k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3k
A designer walks into a library…
pauljervisheath
205
24k
Producing Creativity
orderedlist
PRO
344
40k
Speed Design
sergeychernyshev
27
810
4 Signs Your Business is Dying
shpigford
182
22k
Embracing the Ebb and Flow
colly
84
4.6k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
GitHub's CSS Performance
jonrohan
1030
460k
Writing Fast Ruby
sferik
628
61k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.8k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.2k
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
5
Implementing Domain-Driven Design 6
Value objects 7
Stringly typed code 8 public class Customer { private Long
id; private String firstname, lastname, email; … }
Stringly typed code 9 public class SomeService { public void
createUser(String firstname, String lastname, String email) { … } }
10 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.
11
Still, they’re worth it. 12 See „Power Use of Value
Objects in DDD“ by Dan Bergh Johnsson.
Lombok — putting the spice back into Java. 13
14 @Value public class Customer { UUID id = UUID.randomUUID();
Firstname firstname; Lastname lastname; EmailAddress email; @Value static class EmailAddress { String value; } }
Entities & Aggregates 16
17 Order LineItem Product Invoice Customer Payment Address Email
17 Order LineItem Product Invoice Customer Payment Address Email
Persistence technology VS. Domain model 18
Aggregate = Entity + Repository 19
20 Order LineItem Product Invoice Customer Payment Address Email
Bounded Context 21
Order LineItem Product Invoice Customer Payment Address
23 Shipping Accounting Catalog Orders User Registration
23 Shipping Accounting Catalog Orders User Registration Accounting Payment information
Billing Address Shipping Shipping address Customer Product
Domain-Driven Design & Monoliths 24
Avoid technologies that get in your way. 25
How to enforce context boundaries? 26
What about consistency? 27
References between Bounded Contexts? 28
Domain Events 29
30 Level 0: No events at all
30 Level 0: No events at all Level 1: Explicit
operations
If you’re calling two setters in a row, you’re missing
a concept. 31
32 Level 0: No events at all Level 1: Explicit
operations Level 2: Some operations as events
State transitions become domain events. 33
34 Level 0: No events at all Level 1: Explicit
operations Level 2: Some operations as events Level 3: Event Sourcing
Domain-Driven Design & Microservices 35
Bounded contexts define system boundaries. 36
37 Shipping Accounting Catalog Orders User Registration Accounting Payment information
Billing Address Shipping Shipping address Customer Product
38 Shipping Accounting Catalog Orders User Registration Accounting Shipping
39 Shipping Accounting Catalog Orders User Registration Accounting Shipping HTTP
Messaging
Architecture is less likely to deteriorate as it’s harder to
violate boundaries. 40
Restructuring service boundaries is much harder. 41
Inter-Context communication becomes remote communication. 42
Accept and embrace eventual consistency between services. 43
Domain Events 44
REST & Messaging 45
Domain events become state transitions. 46
Hypermedia for state transition and explicit events. 47
Thanks! 48