DDD journey

DDD.__init__()

As you may already know, Python is one of the world’s fastest-growing programming languages. It's flexible, easy to use, fast to prototype and develop, and has a vibrant community. There are plenty of web excellent frameworks: Django, Flask, FastAPI to name a few. On the other hand, it's not as enterprise-ready as its older brothers - Java and .NET. At least in terms of DDD implementation.

So what is Domain Driven Design all about? To answer this question first we need to understand what domain means. The domain is an area of knowledge, rules, and business activities that the software project is being developed for. Let's say you are developing software for a bank. Therefore, before running to your keyboard, you will need to understand how this bank operates, how saving and deposits work, what procedures and constraints should be reflected in the software system - these are all parts of a banking domain.

Now lets, get back to our original question: there is an excellent introductory article here, but the key takeaways are:

  • Business logic (domain model) is considered to be the most important part of the software. It should be free from technical details and it should be expressed using the language terms shared by business people (a.k.a. domain experts). After all, the goal of the software is to solve business problems.
  • Domain logic is separated from implementation details (i.e. frameworks and databases). Technology tends to evolve much faster than business. Your sexy framework is going to be obsolete in 5 years, but the business will stand the test of time - so you want to make the infrastructure easily interchangeable.

At the moment of writing this post, it's the year 2021 and the knowledge of Domain-Driven Design is still limited in the Python ecosystem, and many of the DDD tactical patterns are still not well understood. Duck typing and monkey patching are not the answers to all problems, especially if your goal is software Maintainability, Readability, and Testability.

The goal of this blog is to fill the gap. I will try to describe DDD concepts and present them in Python context. Wish me luck 🙂


.