Overview
Syllabus
Intro
Modelling by Example Combining BDD and DDD concepts
Behaviour Driven Development
BDD is the art of using examples in conversations to illustrate behaviour - Liz Keogh
Why Examples?
Rules are Ambiguous
Examples are Unambiguous
Examples are Objectively Testable
Gherkin A formal language for examples
You do not have to use Gherkin
Scenarios are not Contracts
Scenarios Create a shared understanding of a feature + Give a starting definition of done → Provide an objective indication of how to test a feature
Domain Driven Design
DDD tackles complexity by focusing the team's attention on knowledge of the domain - Eric Evans
Ubiquitous Language A shared way of speaking about domain concepts → Reduces the cost of translation when business and development communicate → Try to establish and use terms the business will understand
By embedding Ubiquitous Language in your scenarios, your scenarios naturally become your domain model - Konstantin Kudryashov (@everzet)
The best way to understand the domain is by discussing examples → Write scenarios that capture ubiquitous language → Write scenarios that illustrate real situations Directly drive the code model from those examples
Directly driving code with Behat?
Improving scenarios
Add realistic details
Actively seek terms from the domain
Get good at listening
Model values as Value Objects
Model boundaries with Interfaces
Taught by
PHP UK Conference