You might have heard about this thing called DDD which stands for Domain-Driven Design. The name does not reveal much about itself. So maybe you wonder why should you listen about it. What’s so good in it? What problems does it try to solve?
If you look at the cover of the book (often referred to as the Blue Book) which brought a lot of attention to DDD you will see the answer.
The subtitle says “Tackling Complexity in the Heart of Software”. That’s what DDD is all about. Managing, fighting and struggling with complexity. Building software according to certain principles which help us build maintainable code.
So… If every 3 months you start a new simple Rails application, a new prototype which may or may not is successful then probably DDD is not for you. You don’t accumulate enough complexity in 3 months probably. If you work on short projects (in terms of development and time to live) for example, because you work for a marketing agency and that’s the kind of applications you develop then DDD is probably not for you.
When is DDD most useful in my opinion? In the long term. When you work on years-long projects which are supposed to have even more years-long time of usage. When the cost of maintenance and expanding is much more important than the cost of development. But even there you start to introduce the techniques gradually when the need arises. When you see the complexity reaching a certain level. When you understand the domain better.
DDD is just a name for a set of techniques such as:
- Bounded Contexts
- Domain Events
- Value Objects
- Read models
As with every programming technique, you don’t need to use all of them. You can cherry pick those that you benefit most from and start using them at the beginning. In my projects, the most beneficial were Bounded Contexts, Domain Events, Sagas.
- Do I have complexity in my application that I struggle with?
- Do I feel the pain of developing this application?
Because if not then you can watch DDD from distance, with curiosity, but without much commitment to it. You simply have other problems in life :)
But DDD was one of the 5 most important books for DHH so definitelly you will benefit from learning it as well. Join our upcoming DDD workshop in January to spend 2 days practicing those techniques in Rails applications.