Top Banner
Context Oriented Architecture Put the boundary in the right place May 13th-14th 2016 — Verona, Italy Leonardo Proietti @_leopro_
63

Context oriented architecture - Put the boundary in the right place

Apr 13, 2017

Download

Internet

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Context oriented architecture - Put the boundary in the right place

Context Oriented ArchitecturePut the boundary in the right place

May 13th-14th 2016 — Verona, Italy

Leonardo Proietti @_leopro_

Page 2: Context oriented architecture - Put the boundary in the right place

github.com/leopro

Page 3: Context oriented architecture - Put the boundary in the right place

“Any intelligent fool can make things bigger, more complex and more violent.

It takes a touch of genius - and a lot of courage - to move in the opposite

direction.”

Ernst Friedrich Schumacher

Page 4: Context oriented architecture - Put the boundary in the right place

DDD is a learning path

Page 5: Context oriented architecture - Put the boundary in the right place

DDD is a learning path!

Page 6: Context oriented architecture - Put the boundary in the right place

Take care of your Ubiquitous Language

Page 7: Context oriented architecture - Put the boundary in the right place

You need domain experts ...

Page 8: Context oriented architecture - Put the boundary in the right place

… and right devs, UX, designers.

Page 9: Context oriented architecture - Put the boundary in the right place
Page 10: Context oriented architecture - Put the boundary in the right place

Proto

type G

et feedback

Keep going

Page 11: Context oriented architecture - Put the boundary in the right place

Continuous negotiation

Page 12: Context oriented architecture - Put the boundary in the right place

Just because you can

doesn't mean you should.

Page 13: Context oriented architecture - Put the boundary in the right place

Context Matters

Page 14: Context oriented architecture - Put the boundary in the right place

Model

Page 15: Context oriented architecture - Put the boundary in the right place

User Context

Customer Context

Investor Context

Borrower Context

Page 16: Context oriented architecture - Put the boundary in the right place

UserUser Context Customer Context

- Register- Login- Verification

- Store card- Charge card- Apply as customer

Page 17: Context oriented architecture - Put the boundary in the right place

UserUser Context Customer Context

- Register- Login- Verification

- Store card- Charge card- Apply as customer

Identity

Page 18: Context oriented architecture - Put the boundary in the right place

Behaviours, not only data

Page 19: Context oriented architecture - Put the boundary in the right place

Our architecture

Page 20: Context oriented architecture - Put the boundary in the right place
Page 21: Context oriented architecture - Put the boundary in the right place

API

Client

Domain Model

Controller

Command Bus

Persistence

HT

TP

Clie

nt

Qu

eu

e C

lien

t

Domain Model

Controller

Command Bus

Persistence

HT

TP

Clie

nt

Qu

eu

e C

lien

t

Page 22: Context oriented architecture - Put the boundary in the right place

User Context

Customer Context

API CALL

Page 23: Context oriented architecture - Put the boundary in the right place

User Context

Customer Context

Page 24: Context oriented architecture - Put the boundary in the right place

User Context

QUEUE

Worker(Node.js)

Customer Context

Page 25: Context oriented architecture - Put the boundary in the right place
Page 26: Context oriented architecture - Put the boundary in the right place
Page 27: Context oriented architecture - Put the boundary in the right place
Page 28: Context oriented architecture - Put the boundary in the right place
Page 29: Context oriented architecture - Put the boundary in the right place

Behavioural entities AKA rich modeling

Page 30: Context oriented architecture - Put the boundary in the right place
Page 31: Context oriented architecture - Put the boundary in the right place
Page 32: Context oriented architecture - Put the boundary in the right place

Unit Testing

Page 33: Context oriented architecture - Put the boundary in the right place
Page 34: Context oriented architecture - Put the boundary in the right place
Page 35: Context oriented architecture - Put the boundary in the right place
Page 36: Context oriented architecture - Put the boundary in the right place
Page 37: Context oriented architecture - Put the boundary in the right place
Page 38: Context oriented architecture - Put the boundary in the right place
Page 39: Context oriented architecture - Put the boundary in the right place
Page 40: Context oriented architecture - Put the boundary in the right place
Page 41: Context oriented architecture - Put the boundary in the right place

Mitigate the locking

Page 42: Context oriented architecture - Put the boundary in the right place

Quick Invest Command

Handler

Model

Worker (Node) API

Persistence

API

Client

Invest Command

Handler

Model

Queue

Page 43: Context oriented architecture - Put the boundary in the right place
Page 44: Context oriented architecture - Put the boundary in the right place

Third party service integration

Page 45: Context oriented architecture - Put the boundary in the right place

Command

Handler

Model

API

Client

Worker third partyQueueDomain Events

Page 46: Context oriented architecture - Put the boundary in the right place

Command

Handler

Model

API

Client

Worker third partyQueueDomain Events

Worker third partyQueue

Worker third partyQueue

Page 47: Context oriented architecture - Put the boundary in the right place

Functional Testing

Page 48: Context oriented architecture - Put the boundary in the right place
Page 49: Context oriented architecture - Put the boundary in the right place

Customer Context

Investor Context

Request

Response

Page 50: Context oriented architecture - Put the boundary in the right place
Page 51: Context oriented architecture - Put the boundary in the right place

Customer Context

Investor Context

Request

Response

HTTP Client Stub

Page 52: Context oriented architecture - Put the boundary in the right place

Pitfalls

Page 53: Context oriented architecture - Put the boundary in the right place

Value Object (Doctrine embeddable)

Page 54: Context oriented architecture - Put the boundary in the right place

Value Object (Doctrine embeddable)

All the fields related to the Address in the user table must be nullable and you have to validate

them in the model

Page 55: Context oriented architecture - Put the boundary in the right place

Referential integrity

Page 56: Context oriented architecture - Put the boundary in the right place

Referential integrity

Because each service has his on db, you should find another way to enforce the

referential integrity

Page 57: Context oriented architecture - Put the boundary in the right place

Transactional consistency

Page 58: Context oriented architecture - Put the boundary in the right place

Transactional consistency

We are violating the transactional consistency because we’re using the UOW to persist both

Investor and Loan

Page 59: Context oriented architecture - Put the boundary in the right place

“At the end of the day we are selling shoes.”

@cirpo

Page 60: Context oriented architecture - Put the boundary in the right place

Credits

Page 61: Context oriented architecture - Put the boundary in the right place

Thank you.

Page 62: Context oriented architecture - Put the boundary in the right place

Questions?