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
670
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
520
Bottom-Up Architecture – Bridging the Achitecture Code Gap
olivergierke
4
820
Spring Modulith – A Deep Dive
olivergierke
7
4k
Spring for the Architecturally Curious Developer
olivergierke
5
1.7k
Spring Boot 3 & Spring Framework 6
olivergierke
4
2k
Architecturally-evident Java Applications with jMolecules
olivergierke
8
2.7k
A Deep Dive into Spring Application Events
olivergierke
12
3.2k
Building Better Monoliths – Modulithic Applications with Spring Boot
olivergierke
4
900
Spring HATEOAS – Hypermedia APIs with Spring
olivergierke
1
670
Other Decks in Programming
See All in Programming
情報漏洩させないための設計
kubotak
5
1.3k
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
2
7.7k
DMMオンラインサロンアプリのSwift化
hayatan
0
190
traP の部内 ISUCON とそれを支えるポータル / PISCON Portal
ikura_hamu
0
190
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
3
2.2k
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
1.4k
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
1k
QA環境で誰でも自由自在に現在時刻を操って検証できるようにした話
kalibora
1
140
chibiccをCILに移植した結果 (NGK2025S版)
kekyo
PRO
0
140
歴史と現在から考えるスケーラブルなソフトウェア開発のプラクティス
i10416
0
300
Androidアプリの One Experience リリース
nein37
0
1.2k
各クラウドサービスにおける.NETの対応と見解
ymd65536
0
250
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
Making Projects Easy
brettharned
116
6k
Docker and Python
trallard
43
3.2k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.2k
What's in a price? How to price your products and services
michaelherold
244
12k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.5k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.6k
Music & Morning Musume
bryan
46
6.3k
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