Separation of responsibilities
Separation of responsibilities ranks tasks according to their different reasons for change; each responsibility is given a clear role and interface. English is called the Separation of Concerns, a term used by Edsger Dijkstra; at the class level, it is known as Single Responsibility, the S from SOLID.
- FlowCoordinates the sequence of steps.
- Business rulesStatus and transitions of payment.
- ProtocolOnly the external API is known.
Context
Why this is important
When flow, business rules, and provider protocol are stuck in a building block, each change draws the others along. A new error code of the provider then touches the order process. Cohesion within a task is about cohesion.
This building block cuts across the board: business rule, flow and technology each get their own places. Whether the tasks belong together within a place clarifies cohesion.
At a glance · Every task with its own role
Three Responsibilities of Payment
When making a payment, business status rules, the order process and the provider’s API change for various reasons. The shop separates these tasks into suitable building blocks.
This is how you read the picture
- Flow The box ordering process in the area of application.
- Business rules The box payment rules in the business domain.
- Protocol The box provider adapter in the field of technology that calls the payment provider.
Wide diagram · Move laterally if necessary
Read diagram as text
- Ordering process: Coordination of steps (Apply)
- Payment rules: Status and transitions (Business domain)
- Provider adapter: External protocol (Technique)
- Payment provider: Authorisation API (External)
- Ordering process → Payment rules: Starting payment
- Payment rules → Provider adapter: Request authorisation
- Provider adapter → Payment provider: Call for APIs
- Provider adapter → Payment rules: Translating results
Three directions of separation
| Direction | What is Separated | In the shop | Deepened in |
|---|---|---|---|
| Vertical | Business areas | Catalogue, payment, shipping | Cohesion, module boundaries |
| Horizontal | flow, business rule, technology | Order process, payment rules, provider adapter | This building block, layered architecture, hexagonal architecture |
| Cross section | Concerns that are needed everywhere | Logging, Authorization, Error Treatment | Observability, authentication & authorization, gateway |
Benefits & limitations
Helps if:
- Changes to presentation or infrastructure repeatedly damage business rules.
- A task must be independently tested or reused on multiple input paths.
Boundaries
- Layers without a distinct purpose increase coordination and search effort. Assess their responsibilities through Cohesion and concrete change paths.
- Transactions and failures may affect several concerns at once. Identify the coordinating flow and examine its Module Boundaries so these relationships remain visible.
In practice
- Include reasons for change. Separate business rules, technical connection and presentation based on their respective change patterns. The result shows which tasks can be handled independently.
- Assign responsibilities and contracts. Determine which part accepts input, makes decisions and performs technical effects. Use Module Boundaries to define binding handover contracts.
- Test collaboration and failure paths. Check individual responsibilities and the complete flow, including failures. Cohesion helps assess whether related rules remain together.
Read the detailed explanation
A system flow can combine input handling, business decisions, storage and presentation. These concerns can be handled separately at clear boundaries while keeping the overall process understandable. Cohesion groups related tasks; Dependency Inversion keeps the business core independent of infrastructure.
Separation helps when responsibilities change or are tested independently. It still requires explicit coordination for transactions, permissions and failure paths that cross several parts. A layer should have its own responsibility, such as translation, rule checking or flow control; passive pass-through layers add overhead. Assess boundaries against the changes and collaboration required by a complete flow.
Check your understanding
Test yourself in three stages
ReadingCheck in the picture
Which building block calls the payment provider’s API?
View the solution with justification
The provider adapter, via the edge “call API” to the payment provider.
ApplyingTransferred to a new situation
All access to order, payment and shipping should be logged. What direction of separation is this, and where does it belong?
View the solution with justification
A cross-cutting issue. It does not belong in each module individually, but in a common mechanism, such as middleware or a gateway, so that the specialist modules remain free of it.
EvaluateWeighing an alternative
The team is considering merging payment rules and provider adapters. What speaks for and against?
View the solution with justification
For this: a building block fewer and shorter paths. On the other hand, the technical status and the provider protocol have different reasons for change, and a change of provider would affect the rules.
Explore further
These building blocks continue the thoughts of this page.
References
- Edsger W. Dijkstra · On the role of scientific thought (EWD447) (opens in new tab)Text of 1974In which Dijkstra coined the term Separation of Concerns.
- Microsoft Architectural Principles (opens in new tab)Explains Separation of Concerns, Encapsulation and Dependency Inversion.
- Alistair Cockburn - Hexagonal Architecture (opens in new tab)Original description of ports, adapters and interchangeable external connections.