Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is clean domain-driven-design(DDD) a utopia? [closed]

I think I read all the book's on DDD and how to apply it in C# (3-5 books, don't remember it was few years ago).

But during last 2 years I was using anemic domain model in all projects and it worked well. Actually I have never tried to implement pure domain model, moreover I have never seen a piece of code using clean domain model approach.

Take for example code from the book's about DDD doesn't follow DDD style. Take for example code code from Tim MacCarthy book about DDD http://dddpds.codeplex.com/, look at his domain objects, they are clean from any behavior's it's just DTO's the only thing he integrated into domain object is validation, if I remember correctly in DDD your domain should not be in invalid state, so you should prevent setting invalid values and throw exception's instead of allowing to set them and do validation at some point.

Same situation with other books and sample codes, they all are very simple and shows just a class with properties, maximum what you can find is a set of methods for inserting\removing child objects which set the parent property. For example I almost neven seen code using domain events, or injecting services into domain objects.

In 2003 Martin Fowler wrote an article telling us that Anemic Domain Model is a bad thing http://www.martinfowler.com/bliki/AnemicDomainModel.html 8 years passed and I think Anemic model is quite popular now (it evoluted to Layered Architecture). And is used alot in 3-Tier RIA development.

So my main question is clean DDD a utopia? Is it dead? Becouse all the code I see around for last 3 years is Layered Architecture (in my opinion it's essetialy anemic domain model). And I would very like to see some clean DDD code if it exists.

like image 677
Alex Burtsev Avatar asked Jun 08 '11 07:06

Alex Burtsev


People also ask

What is the difference between DDD and Microservices?

DDD provides an avenue to facilitate the development of highly cohesive systems through bounded contexts. Microservices is an implementation approach that encourages you to focus your service boundaries on the business domain boundaries.

Is DDD a design pattern?

Bounded Context is a central pattern in Domain-Driven Design. It is the focus of DDD's strategic design section which is all about dealing with large models and teams. DDD deals with large models by dividing them into different Bounded Contexts and being explicit about their interrelationships.

What are domain services DDD?

Domain Services (or just Services in DDD) is used to perform domain operations and business rules. In his DDD book, Eric Evans describes a good Service in three characteristics: The operation relates to a domain concept that is not a natural part of an Entity or Value Object.


1 Answers

You are not alone. In most places true DDD will be an utopia. In my experience it is due to two main reasons.

  1. The business is not mature to help developers to do the domain modelling. There is not enough time, resource, energy to do it.
  2. The project team is not very experienced specially if they haven't done DDD before.

DDD is also not suitable in many CRUDy apps. There is also alternate approaches like CQRS. see also the following blog links that make a case for anaemic domain models.

http://codebetter.com/gregyoung/2009/07/15/the-anemic-domain-model-pattern/
http://lostechies.com/jimmybogard/2009/12/03/persistence-model-and-domain-anemia/

like image 198
softveda Avatar answered Sep 27 '22 16:09

softveda