Skip to content

Instantly share code, notes, and snippets.

@npathai
Last active September 15, 2020 04:10
Show Gist options
  • Save npathai/190b4a3dd7d6acae6cd18fb6818d07d9 to your computer and use it in GitHub Desktop.
Save npathai/190b4a3dd7d6acae6cd18fb6818d07d9 to your computer and use it in GitHub Desktop.
Notes for capturing the understanding from the books on Domain Driven Design

Ubiqutous language

In DDD it really important that everyone business people and developers share a model. A model is shared understanding of the system. It helps in forming a common language between all the stakeholders. This makes sure that the code design doesn't drift from the model and it reflects the domain.

Model

The model has to be tightly associated with the domain it comes from. Designing without a model can lead to software which is not true to the domain it serves, and may not have the expected behavior.

One of the first things we are taught about modeling is to read the business specifications and look for nouns and verbs. The nouns are converted to classes, while the verbs become methods. This is a simplification, and will lead to a shallow model. All models are lacking depth in the beginning, but we should refactor the model toward deeper and deeper insight.

A model should be small enough to be assigned to one team.

A model contains the following:

Entities

Represent domain objects that are idenfiable with an id, and have a uniqueness. Like a Person, Customer, etc. The equality of entities is based on their id.

Value Objects

Represent value containers, like street, address line1 and address line 2 can be combined into Address value object. They are place holders for values. Two value objects with same values are considered equal.

Aggregates

Service

Factories

Repositories

Continuous Refactoring

Sophisticated domain models are seldom developed except through an iterative process of refactoring, including close involvement of the domain experts with developers interested in learning about the domain.

Bounded Context

A bounded context is not a module, it provides the logical frame inside of which the model evolves. So bounded context encompasses the Module. Each Bounded Context should have a name which should be part of the Ubiquitous Language.

Context Map

A Context Map is a document which outlines the different Bounded Contexts and the relationships between them. What it is important is that everyone working on the project shares and understands it.

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