Context oriented architecture - Put the boundary in the right place

Post on 13-Apr-2017

734 Views

Category:

Internet

3 Downloads

Preview:

Click to see full reader

Transcript

Context Oriented ArchitecturePut the boundary in the right place

May 13th-14th 2016 — Verona, Italy

Leonardo Proietti @_leopro_

github.com/leopro

“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

DDD is a learning path

DDD is a learning path!

Take care of your Ubiquitous Language

You need domain experts ...

… and right devs, UX, designers.

Proto

type G

et feedback

Keep going

Continuous negotiation

Just because you can

doesn't mean you should.

Context Matters

Model

User Context

Customer Context

Investor Context

Borrower Context

UserUser Context Customer Context

- Register- Login- Verification

- Store card- Charge card- Apply as customer

UserUser Context Customer Context

- Register- Login- Verification

- Store card- Charge card- Apply as customer

Identity

Behaviours, not only data

Our architecture

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

User Context

Customer Context

API CALL

User Context

Customer Context

User Context

QUEUE

Worker(Node.js)

Customer Context

Behavioural entities AKA rich modeling

Unit Testing

Mitigate the locking

Quick Invest Command

Handler

Model

Worker (Node) API

Persistence

API

Client

Invest Command

Handler

Model

Queue

Third party service integration

Command

Handler

Model

API

Client

Worker third partyQueueDomain Events

Command

Handler

Model

API

Client

Worker third partyQueueDomain Events

Worker third partyQueue

Worker third partyQueue

Functional Testing

Customer Context

Investor Context

Request

Response

Customer Context

Investor Context

Request

Response

HTTP Client Stub

Pitfalls

Value Object (Doctrine embeddable)

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

Referential integrity

Referential integrity

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

referential integrity

Transactional consistency

Transactional consistency

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

Investor and Loan

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

@cirpo

Credits

Thank you.

Questions?

top related