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
What's new in Spring Modulith?
olivergierke
1
240
Domain-centric? Why Hexagonal and Onion Architecture Are Answers to the Wrong Question
olivergierke
4
1.9k
It Takes Two to Tango – Designing Module Interactions in Modulithic Spring Applications
olivergierke
5
780
Bottom-Up Architecture – Bridging the Achitecture Code Gap
olivergierke
4
1k
Spring Modulith – A Deep Dive
olivergierke
9
5k
Spring for the Architecturally Curious Developer
olivergierke
5
1.9k
Spring Boot 3 & Spring Framework 6
olivergierke
4
2.1k
Architecturally-evident Java Applications with jMolecules
olivergierke
9
3k
A Deep Dive into Spring Application Events
olivergierke
12
3.4k
Other Decks in Programming
See All in Programming
CSC307 Lecture 10
javiergs
PRO
1
680
文字コードの話
qnighy
3
800
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
850
AIに仕事を丸投げしたら、本当に楽になれるのか
dip_tech
PRO
0
140
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
22
7.8k
ご飯食べながらエージェントが開発できる。そう、Agentic Engineeringならね。
yokomachi
1
200
余白を設計しフロントエンド開発を 加速させる
tsukuha
7
2.2k
Event Storming
hschwentner
3
1.3k
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
300
浮動小数の比較について
kishikawakatsumi
0
300
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
320
Apache Iceberg V3 and migration to V3
tomtanaka
0
210
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
698
190k
Writing Fast Ruby
sferik
630
62k
Context Engineering - Making Every Token Count
addyosmani
9
680
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
How to Think Like a Performance Engineer
csswizardry
28
2.5k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
110
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
750
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
WCS-LA-2024
lcolladotor
0
460
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