What makes my DDD (Domain Design) code qualified?

I am new to DDD and am thinking about using this design technique in my project.

However, what bothers me about DDD is how basic the idea is. Unlike other design methods, such as MVC and TDD, it does not seem to contain any underlying ideas.

For example, I am sure that some of you will have the same feeling that the idea of ​​root aggregates and repositories is not new, because when you write MVC web applications, you should have one single main object (i.e. i.e., the root aggregate) that contain other secondary objects (i.e., objects and value objects) at the model level to send data to a strongly typed representation.

For me, the only new idea in DDD is probably

  • Smart Entities (i.e. you must have business rules for root aggregates)
  • Separation between the value object, root aggregation and entities.

Can someone tell me that I missed something here? If this is all for DDD, if I update one of my existing MVC application with the above two new ideas, can I approve it with TDD, MVC and DDD?

+7
design architecture domain-driven-design
source share
2 answers

The short answer is that it does not match your code, which qualifies it as a DDD project, how did you arrive at that code. Now for the long version ...

You are absolutely right that there is nothing revolutionary about DDD encoding methods, but you seem to be a little tuned to your question. A common mistake many developers make with DDD is that they pay too much attention to coding practice, ignoring some of the more fundamental DDD concepts. At its core, DDD is the practice of iteratively developing a model with close collaboration between developers and experts in the field. You can program all the services, objects, and value objects that you want, but if you do not use domain experts in this process or do not improve the model by iterations, then, frankly, you do not practice DDD. Even from the point of view of coding, many consider the concepts of aggregate roots, limited contexts and levels of anti-corruption more valuable tools than the basic patterns.

You are not alone in how you perceive DDD. I found that almost all developers go through the DDD stage, where they try to implement application examples using entities, value objects, and services, while ignoring all the other methods that are fundamental to DDD. DDD is a process designed to process complex business logic, so judging by its merits in a sample application developed over the weekend, you cannot provide you with the best that DDD can offer. I urge you to continue to dive deeper into DDD, because I found it an indispensable tool, but I never forget that it is much more than a template language.

+14
source share

DDD is not really a checklist - it's a methodology.

In addition to Stefans answer, I would suggest the following (in order of importance):

  • The omnipresent language . Does your code use the same names / terms as the business? Do your domain objects use the same names as the business?
  • Behavior . Is this most of the behavior / logic associated with domain objects, or do you have a lot of dumb DTOs?
  • Limited contexts . Have you clearly identified areas of responsibility and separation of concerns?
  • Aggregates - Have you identified Aggregates based on root objects and blocking strategies to provide business invariants?
  • Repositories - all access / request data is executed through the Repositories, or do you have SQL code in other classes?
  • Domain Services . You have domain services for business logic that does not fit into the domain object
  • Technical Specifications Do you have business rules that are well-written in specifications?
  • Request Specification . Do you have pre-programmed queries / wrapper filters in query specifications?

Then everything else!

I think most DDD practitioners would like to say:

"I work with experts in the domain to understand their needs, and write systems that (a) fit the business environment and processes, (b) help other developers understand the business domain, and (c) can flexibly adapt changing business requirements."

Hope this helps!

+7
source share

All Articles