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
620
2
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 JUG Saxony Day 2016.
@springcentral
Oliver Drotbohm
September 30, 2016
More Decks by Oliver Drotbohm
See All by Oliver Drotbohm
What's new in Spring Modulith?
olivergierke
1
330
Domain-centric? Why Hexagonal and Onion Architecture Are Answers to the Wrong Question
olivergierke
4
2.1k
It Takes Two to Tango – Designing Module Interactions in Modulithic Spring Applications
olivergierke
5
830
Bottom-Up Architecture – Bridging the Achitecture Code Gap
olivergierke
4
1.1k
Spring Modulith – A Deep Dive
olivergierke
9
5.7k
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
3.2k
A Deep Dive into Spring Application Events
olivergierke
12
3.5k
Other Decks in Programming
See All in Programming
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
17
9k
えっ!!コードを読まずに開発を!?
hananouchi
0
200
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
210
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
3
890
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.4k
共通化で考えるべきは、実装より公開する型だった
codeegg
0
220
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1.2k
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
170
【やさしく解説 設計編 #0】DDDのコード、読めるのに分からない人へ
panda728
PRO
2
260
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
320
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
630
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
260
Featured
See All Featured
AI: The stuff that nobody shows you
jnunemaker
PRO
8
830
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Why Our Code Smells
bkeepers
PRO
340
58k
Being A Developer After 40
akosma
91
590k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
190
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
900
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
360
A Modern Web Designer's Workflow
chriscoyier
698
190k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
The Limits of Empathy - UXLibs8
cassininazir
1
480
Faster Mobile Websites
deanohume
310
32k
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