Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
© 2014 SpringOne 2GX. All rights reserved. Do not distribute without permission. DOMAIN-DRIVEN DESIGN / OLIVERGIERKE ƻ
[email protected]
GRUNDLEGENDES FÜR MICROSERVICES
Slide 2
Slide 2 text
2
Slide 3
Slide 3 text
No content
Slide 4
Slide 4 text
4 http://www.infoq.com/minibooks/domain-driven-design-quickly
Slide 5
Slide 5 text
Microservices ♥ Domain-Driven Design 5 Slides and video by Michael Plöd.
Slide 6
Slide 6 text
6
Slide 7
Slide 7 text
6
Slide 8
Slide 8 text
Implementing Domain-Driven Design 7
Slide 9
Slide 9 text
Value objects 8
Slide 10
Slide 10 text
Stringly typed code 9 public class Customer { private Long id; private String firstname, lastname, email; … }
Slide 11
Slide 11 text
Stringly typed code 10 public class SomeService { public void createUser(String firstname, String lastname, String email) { … } }
Slide 12
Slide 12 text
11 public class Customer { private Long id; private Firstname firstname; private Lastname lastname; private EmailAddress emailAddress; … }
Slide 13
Slide 13 text
Value Objects are a PITA to build in some languages. 12
Slide 14
Slide 14 text
Still, they’re worth it. 13 See „Power Use of Value Objects in DDD“ by Dan Bergh Johnsson.
Slide 15
Slide 15 text
Lombok — putting the spice back into Java. 14
Slide 16
Slide 16 text
15 @Value public class Customer { UUID id = UUID.randomUUID(); Firstname firstname; Lastname lastname; EmailAddress email; @Value static class EmailAddress { String value; } }
Slide 17
Slide 17 text
AutoValue 16 Project website on GitHub.
Slide 18
Slide 18 text
Key opponents: Mapping libraries that need to (de)serialize them. 17
Slide 19
Slide 19 text
Entities & Aggregates 18
Slide 20
Slide 20 text
Persistence technology VS. Domain model 19
Slide 21
Slide 21 text
Challenges with JPA: Value objects as @Entity Flat relationships 20
Slide 22
Slide 22 text
21 Order LineItem Product Invoice Customer Payment Address Email
Slide 23
Slide 23 text
21 Order LineItem Product Invoice Customer Payment Address Email
Slide 24
Slide 24 text
Repositories turn an entity into an aggregate root. 22
Slide 25
Slide 25 text
23 Order LineItem Product Invoice Customer Payment Address Email
Slide 26
Slide 26 text
Bounded Context 24
Slide 27
Slide 27 text
Order LineItem Product Invoice Customer Payment Address
Slide 28
Slide 28 text
26 Shipping Accounting Catalog Orders User Registration
Slide 29
Slide 29 text
26 Shipping Accounting Catalog Orders User Registration Accounting Payment information Billing Address Shipping Shipping address Customer
Slide 30
Slide 30 text
26 Shipping Accounting Catalog Orders User Registration Accounting Payment information Billing Address Shipping Shipping address Customer Product
Slide 31
Slide 31 text
Domain-Driven Design & Monoliths 27
Slide 32
Slide 32 text
Avoid technologies that get in your way. 28
Slide 33
Slide 33 text
How to enforce context boundaries? 29
Slide 34
Slide 34 text
What about consistency? 30
Slide 35
Slide 35 text
References between Bounded Contexts? 31
Slide 36
Slide 36 text
Domain Events 32
Slide 37
Slide 37 text
33 Level 0: No events at all
Slide 38
Slide 38 text
33 Level 0: No events at all Level 1: Explicit operations
Slide 39
Slide 39 text
If you’re calling two setters in a row, you’re missing a concept. 34
Slide 40
Slide 40 text
35 Level 0: No events at all Level 1: Explicit operations
Slide 41
Slide 41 text
35 Level 0: No events at all Level 1: Explicit operations Level 2: Some operations as events
Slide 42
Slide 42 text
State transitions become domain events. 36
Slide 43
Slide 43 text
37 Level 0: No events at all Level 1: Explicit operations Level 2: Some operations as events
Slide 44
Slide 44 text
37 Level 0: No events at all Level 1: Explicit operations Level 2: Some operations as events Level 3: Event Sourcing
Slide 45
Slide 45 text
Domain-Driven Design & Microservices 38
Slide 46
Slide 46 text
Bounded contexts define system boundaries. 39
Slide 47
Slide 47 text
40 Shipping Accounting Catalog Orders User Registration Accounting Payment information Billing Address Shipping Shipping address Customer Product
Slide 48
Slide 48 text
41 Shipping Accounting Catalog Orders User Registration Accounting Shipping
Slide 49
Slide 49 text
42 Shipping Accounting Catalog Orders User Registration Accounting Shipping HTTP Messaging
Slide 50
Slide 50 text
Architecture is less likely to deteriorate as it’s harder to violate boundaries. 43
Slide 51
Slide 51 text
Restructuring service boundaries is much harder. 44
Slide 52
Slide 52 text
Inter-Service communication becomes remote communication. 45
Slide 53
Slide 53 text
Accept and embrace eventual consistency between services. 46
Slide 54
Slide 54 text
Domain Events 47
Slide 55
Slide 55 text
REST & Messaging 48
Slide 56
Slide 56 text
Domain events become state transitions. 49
Slide 57
Slide 57 text
Hypermedia for state transition and explicit events. 50
Slide 58
Slide 58 text
Thanks! 51