DDD & Microservices At last, some boundaries! Eric Evans @ericevans0 domainlanguage.com
Why do I like microservices? • Autonomous teams with isolated implementation. • Acknowledge the rough and tumble of enterprises. • Cattle not pets. • A philosophical break from the past — gives us a chance to shake assumptions.
Possibly, some other people mean something else: What I’m saying may not apply to that!
Services and Messages S m m m m m m
m m m A B m m m
a a a A B b b b How do they understand the messages?
Bounded Context • context The setting in which a word or statement appears that determines its meaning • bounded context The conditions under which a particular model is defined and applicable.
a a a A B b b b Context Map partners B A
C a a a a a a A B b b b Context Map partners B A
Asymmetrical Relationships relationship Context Name Context Name (point toward power)
C a a a a a a A B b b b Context Map C partners B A
C a a a a a a A B b b b Context Map C conforms partners B A
D C a a a a a a a a a A B b b b Context Map C conforms partners B A
D C a a a a a a a a a A B b b b Context Map D C AC conforms partners B A
D C a a a a a a a a a E A B a a b b b Context Map D C AC conforms partners B A
D C a a a a a a a a a E A B a a b b b Context Map D C AC conforms partner conforms B E A s
D C a a a a a a a a a a a a E A B a a b b b Context Map D C AC conforms partner conforms B E A s
D C F f a a a a b a a a a b a a a a E A B a a b b b Context Map D C AC conforms partner conforms B E A s
D C F f a a a a b a a a a b a a a a E A B a a b b b Context Map D C F conforms AC AC conforms partners conforms B E A
Models need to be clear, not big. • Useful models need crisp definitions. • Definitions require clear context. • Useful models need simple assertions. • Assertions require boundaries.
There are always multiple models.
D C F f a a a a b a a a a b a a a a E A B a a b b b Context Map D C F conforms AC AC conforms partners conforms B E A
D C F f a a a a b a a a a b a a a a E A B a a b b b Context Map D C F conforms AC AC conforms partners conforms B E A
D C F f a a a a b a a a a b a a a a E A B a a b b b Context Map D C F conforms BBoM AC AC conforms partners conforms B E A
D C F f a a a a b a a a a b a a a a E A B a a b b b Context Map D C F conforms BBoM BBoM AC AC conforms partners conforms B E A
D C F f ae a a ae b a a ae a b a a a a E A B a e a e b b b Context Map D Fiction! C F conforms BBoM BBoM Map what is . AC AC conforms partners conforms B E A
Not all of a large system will be well designed.
D C F f ae a a ae b a a ae a b a a a a E A B a e a e b b b Context Map D Patterns describe C F conforms good places to be. BBoM BBoM AC AC ??? conforms partners ??? B E A BBoM
D C F f ae a a ae b a a ae a b a a a a E A B a e a e b b b Context Map D C F conforms AC BBoM BBoM AC AC conforms partners B E A AC BBoM
Interchange context
D C F f a a a a b a a a a b a a a a E A B a a b b b Context Map D C F conforms AC AC conforms partners conforms B E A
D C F f i i i i b i i i b i i a a a E A B i i b b b Context Map D C F conforms AC AC conforms partners conforms B E A
D C F f i i i i b i i i b i i a a a E A B i i b b b Context Map D C F conforms AC AC conforms conforms E I partners B A AC
Why not logical boundaries? • Smart people point out that most of what I want is the logical partitioning of the system. • We’ve had decades to get that to work. • Some techniques are too subtle to survive the rough and tumble.
Wrap up • Subtle design (such as DDD) requires concrete boundaries. • Lots of services recreate some of the old problems. • Context Maps help visualize and communicate about those problems. • Modest use of interchange contexts is one way of organizing coherent services.
Not all of a large system will be well designed.
DDD & Microservices At last, some boundaries! Eric Evans @ericevans0 domainlanguage.com
Recommend
More recommend