Session
Refactoring with the Sandwich pattern
In this session, we'll try to solve a very common problem in software development teams: dealing with legacy procedural code without tests.
In the Sandwich pattern, we start from a class (generally an Application Service). We identify where it uses shared state (generally from a database). Then we push that code to its extremes (up and down) between which we have an immutable domain model that we can interact with.
The idea is to protect our code using Approval Tests and refactor this procedural code to domain-centric code.
We'll use good practices to finally reach services that correspond to the Sandwich pattern and coherent rich domain objects containing business behaviours.
In between exercises, we'll discuss:
- How Temporal Coupling can help us to respect our use case
- What is a pure and isolated Domain model?
- Understanding Domain Completeness
- What is the difference between an Application Service & a Domain Service ?
- Does Sandwich pattern helps us to make clean Domain Services ?
The exercises will be available in Java and C#.

Hadi Ahmadi
Independent Software Architect & Consultant, Co-Founder of DDD Iran Community
Tehran, Iran
Links
Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.
Jump to top