Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Fundamental Domain-Driven Design For Microservices
Search
Oliver Drotbohm
April 19, 2016
Programming
1.2k
11
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Fundamental Domain-Driven Design For Microservices
Slides of the talk I gave at JAX 2016, Mayence.
@springcentral
Oliver Drotbohm
April 19, 2016
Transcript
58 slides
© 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
More Decks by Oliver Drotbohm
See All by Oliver Drotbohm
What's new in Spring Modulith?
olivergierke
1
400
Domain-centric? Why Hexagonal and Onion Architecture Are Answers to the Wrong Question
olivergierke
4
2.6k
It Takes Two to Tango – Designing Module Interactions in Modulithic Spring Applications
olivergierke
5
880
Bottom-Up Architecture – Bridging the Achitecture Code Gap
olivergierke
4
1.1k
Spring Modulith – A Deep Dive
olivergierke
9
6.1k
Spring for the Architecturally Curious Developer
olivergierke
5
2k
Spring Boot 3 & Spring Framework 6
olivergierke
4
2.2k
Architecturally-evident Java Applications with jMolecules
olivergierke
9
3.2k
A Deep Dive into Spring Application Events
olivergierke
12
3.6k
Other Decks in Programming
See All in Programming
SONY CISC-NEWS NWS-1750 + NWB-225 ハードウェアメンテとフレームバッファカラー対応 / KOF2026
tsutsui
0
130
疎結合とは何か?ソフトウェア設計における結合バランスについて考える #phpcon_niigata
kajitack
2
420
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
340
AIコーディングをセッションで終わらせない: PHPライブラリ開発におけるコンテキスト承継設計
ickx
0
110
AIコーディング時代のKotest ユニットテストから APIレベルの仕様固定化テストへ
ooga04
0
330
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
420
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
15
12k
Beyond Chatbots: Agentic UI with Open Standards @W-JAX 2026, München
manfredsteyer
PRO
0
130
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
360
Kotlin Fest 2026: Kotlin コンパイラに Contribute してみよう! - Kotlin/Wasm で深い再帰を書けるようにした話
ternbusty
1
420
小さなアプリを作って公開するまで
onozaty
0
240
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
800
Featured
See All Featured
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
610
Producing Creativity
orderedlist
PRO
348
41k
Rails Girls Zürich Keynote
gr2m
96
14k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
550
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.5k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
680
Automating Front-end Workflow
addyosmani
1370
210k
Web Performance Is a Journey [PerfNow 2026]
tammyeverts
2
150
Speed Design
sergeychernyshev
33
2.3k
Technical Leadership for Architectural Decision Making
baasie
4
660
Amusing Abliteration
ianozsvald
1
400
The SEO Collaboration Effect
kristinabergwall1
1
630