DDD — Domain Driven Development
One of the new challenges I faced at my new job was understanding and adapting to DDD. It can be a bit confusing at first, but as soon as I made sense of it, I couldn’t not recommend it.
In this post i want to explain the basic concept of DDD.
What is DDD?
DDD consists in one domain project that doesn’t depend on anything, while the other projects depend on it. Usually, the domain project contains interfaces, domain entities and utility classes that don’t depend on third parties. Confusing? I’ll explain better in the example below.
A small application to manage tasks (The famous Todos application).
List of projects and their dependencies.
Ps: The projects names should clarify their functions.
Todos — Domain project.
Todos.Manager.Task — Manager with all business rules.
Todos.Repository.Memory — Memory repository to save the data.
Todos.Repository.SqlServer — Sql Server repository to access the data base.
Todos.WebApi — Web api to access the data.
To change the repository implementation we just need to change the configuration file. In this way we don’t need to change any code.
Sql Server Repository:
- Simple and robust architecture
- Dependencies and responsibilities are well defined
- Works well with Dependency Injection
- New members adapts easily if they know this development concept
- Too much responsibility in one project (Domain Project)
I hope this post can help you to understand better the DDD concept :)