DEV Community

Fernando Correia
Fernando Correia

Posted on

Bounded contexts

Definition

Summarizing and paraphrasing what was described by Nick Tune:

Domain modeling is about defining a shared language between domain experts and system builders. The same words can have different meanings, depending on context. Domains are boundaries around a set of concepts.

When modelling systems we have to choose the most appropriate domain boundaries with which to align our software and organisational boundaries.

In domain modeling a bounded context is the boundary of a model that represents the concepts of a domain, their relationships, and their rules.

Domains are hierarchical. They can be split into subdomains, and each of these "subordinate domains" can be split in turn.

Since a bounded context is a boundary for a model, it could include concepts from multiple subdomains. Or a single subdomain could be modelled as multiple bounded contexts.

As described by Dave Taubler:

A bounded contexts is a context — essentially, a system that encapsulates cooperative components — with clearly-defined boundaries that govern what can enter the system, and what can exit it.

Bounded contexts are as much about organizing teams as they are about software architecture. They enable decoupled code and decoupled teams that can take full ownership over their work.

Relationship to cohesion and coupling

Bounded contexts are related to the principles of cohesion and coupling.

When defining multiple bounded contexts within a domain, each bounded context needs to have internal cohesion (i.e. the concepts encompassed by the bounded context should be closely related) and it should be loosely coupled to other bounded contexts (for instance in respect to relationships and business rules).

References and further reading

Top comments (0)