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.

Project list


Unity Integration

To change the repository implementation we just need to change the configuration file. In this way we don’t need to change any code.

Memory Repository:

Memory Repository

Sql Server Repository:

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 🙂

I'm a Software Engineer that believes software must be simple, intuitive and reliable. My main interests are api’s design, best software practices, distributed systems and continuous integration.

Your email address will not be published. Required fields are marked *

4 thoughts on “DDD – Domain Driven Development”

    Nice post but a few things I’d like to clarify. I’m not a DDD expert but from this post I’ll say that you might be missing some of the essence of DDD (correct me if I’m wrong).

    In the “what is DDD section”, you didn’t clearly state what DDD is. DDD is not based on visual studio projects and the way they’re arranged. It’s used to tackle complex business solutions, encourages customer collaboration to ensure you understand the problem you’re trying to solve and provides guidelines/patterns on how to arrange your codes. Your “Domain Model” is the core of your application (it’s better to have a separate project for this but that’s not necessary). Your domain model contains your domain logic (business rules, entities, value object, domain services, …).

    You don’t necessarily need an IoC container for DDD. Using DDD does not mean you’ve got a super solution that is perfectly designed, easy to test, and maintain. You can have several projects in one VS solution that are still tightly coupled.

    First of all, thanks for the comment. I will try to answer your questions. You are right, it’s not about Visual Studio projects it’s a way of development you can implement it in Java, C++ or other language. The meaning of DDD it’s having a Domain Project with the Core of the application (Domain model, Interfaces, Utility classes) and the other projects have a reference for the domain project and can implement the interfaces. I prefer to have separate projects because you can have multiple implementations of the same thing and you don’t need to repeat models or interfaces, you just add the reference to the domain project. If you download the code you can see you have 2 repository implementations and i don’t repeat code i just reuse it.
    I know it’s not necessary a IoC and i did not say it’s necessary, i just said works well with DDD and i recommend using a IoC because makes the code cleaner and easier to configure. I hope this comment help you to understand better the concept.

    I don’t think this post explains the basic concepts, it’s more a simple example of implementing DDD with unity.

    It’s just a basic explanation. If you want go further you have several books and articles. In my example the Domain project has all the Business Models and Logic Interfaces.

    In this link http://dddcommunity.org/learning-ddd/what_is_ddd/ you can see the primary goals of DDD.