Hadi Ahmadi

Hadi Ahmadi

Independent Software Architect, Consultant, DDD Teacher, Co-Founder of DDD Iran Community
· Twitter · LinkedIn ·
· Refactoring with the Sandwich pattern
· Testing Domain Invariants with Property-Based Testing

Bio

With over 10 years of experience in Software development, I am a Technical Leader, Architect and Designer. Passionate for Software design & Architecture (specially DDD, CQRS & Event Sourcing) and Agile practices such as TDD and BDD with an in depth knowledge of OOP, GoF Design Patterns, SOLID Principles and Integration Patterns.


Refactoring with the Sandwich pattern (Lab)
by Hadi Ahmadi, Sepehr Namdar

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 ?
- What is a completness Domain model?

The exercises will be available in Java and C#.


Testing Domain Invariants with Property-Based Testing (Lab)
by Hadi Ahmadi, Sepehr Namdar

The first step in developing a domain model, is to analyze the problem and then break it up into smaller parts. TDD is a great technique that many developers use for this purpose. Most developers use example-based approach for writing their tests and don't consider other methods.

Property-based testing requires us to approach testing differently from what we’re used to. In property-based testing, you write tests not by specifying examples, but by describing the rules and properties and generating the examples automatically.

In this hands-on, we write property-based tests for an object-oriented domain model, TDD style, and explore the way of breaking down invariants into smaller parts and develop in small increments. The purpose of the workshop is to show attendees how they can use property-based testing as a tool for exploring the problem domain and invariants more in-depth and develop in small steps.

In this sessions, we will:

- Explain Property-Based Testing
- Explain the ways of writing properties
- Describe a problem to implement
- Break down invariants into smaller parts
- Writing Properties first
- Implementing domain model to pass the tests

The examples will be available in Java and C#.

Join the mailing list

for updates about the DDD Europe Conference and workshops