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
600
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
730
Bottom-Up Architecture – Bridging the Achitecture Code Gap
olivergierke
4
960
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
760
Other Decks in Programming
See All in Programming
How Android Uses Data Structures Behind The Scenes
l2hyunwoo
0
480
MCPとデザインシステムに立脚したデザインと実装の融合
yukukotani
4
1.4k
テストカバレッジ100%を10年続けて得られた学びと品質
mottyzzz
2
610
Putting The Genie in the Bottle - A Crash Course on running LLMs on Android
iurysza
0
140
Swift Updates - Learn Languages 2025
koher
2
490
GitHubとGitLabとAWS CodePipelineでCI/CDを組み比べてみた
satoshi256kbyte
4
240
複雑なフォームに立ち向かう Next.js の技術選定
macchiitaka
2
200
概念モデル→論理モデルで気をつけていること
sunnyone
3
290
print("Hello, World")
eddie
2
530
Performance for Conversion! 分散トレーシングでボトルネックを 特定せよ
inetand
0
2.4k
Tool Catalog Agent for Bedrock AgentCore Gateway
licux
7
2.5k
The Past, Present, and Future of Enterprise Java with ASF in the Middle
ivargrimstad
0
160
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
61k
Designing Experiences People Love
moore
142
24k
Building Adaptive Systems
keathley
43
2.7k
Docker and Python
trallard
46
3.6k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Fireside Chat
paigeccino
39
3.6k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Gamification - CAS2011
davidbonilla
81
5.4k
Imperfection Machines: The Place of Print at Facebook
scottboms
268
13k
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