Skip to content

Instantly share code, notes, and snippets.

@krisleech
Last active March 7, 2017 10:44
Show Gist options
  • Select an option

  • Save krisleech/c5f297430425c68240e8 to your computer and use it in GitHub Desktop.

Select an option

Save krisleech/c5f297430425c68240e8 to your computer and use it in GitHub Desktop.
Notes of DDD / SOA / EDA and their boundaries

Boundaries

Business goals (Requirements)

The goals of the business

Service (User Interface)

Implements a bounded context Exposes resources HTTP used for scaleability (Stateless) Navigated using hypermedia, client only needs to know root URL Not dependant on anything other than event bus UI could be HTML (person), JSON (machine) etc. HTML UI is task based, not CRUD (data) based.

Bounded context (domain model)

Event bus (Infrastructure)

Receives messages from producers Forwards messages to listening consumers

e.g. RabbitMQ, Redis

Message (domain model)

Something significant which happened

Hexagon

Dependencies point inwards Domain model on the inside (aggregates, commands etc.) Adapters for external concerns, e.g. data store

Commands (domain model)

Encapsulates a business usecase Named such as CreateReviewProduct Have side effects Mutate "write" database OR event store Publish event, named in past tense e.g. ProductReviewed Talk to one aggregate root

Queries (domain model)

Encapsulates a business usecase Named as such FetchProductReview Have no side effects Read from "read" database Talk to one aggregate root

Aggregate (domain model)

Encapsulates related entities One entity is the root, direct access of other entities is not possible.

Entity (domain model)

Model a distinct business concept, e.g. Product Has an identity Rich in behaviour

Value object (domain model)

Models something without identity, e.g. Address

Event store

Stores events, i.e. changes to aggregates Form an audit trail for reporting Publish event that a new event has been received schema: aggregate_id, event_name, data

e.g. MongoDB

Repository (Infrastructure)

Read/Write entities to/from data store

Denormalizer (Infrastructure)

Listens to events published by event store, commands (in process) or services. Writes denormalized data to "read" database Caches locally data fron other services

Read database (Infrastructure)

Fully denormalized removing need for JOIN's Each table provides a view of the data, tables may contain duplicate data.

e.g. MySQL, Postgres, MongoDB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment