Earlier this year Jimmy Nilsson of factor10 presented a great talk entitled “Domain Driven Design – Is it more than just Entities and Repositories?” at PBT Group in Cape Town. I certainly agree with Jimmy: it is more than just entities and repositories. While the entity, value object, repository, factory and other patterns are commonly sprinkled in a rich domain model, the subtleties of DDD such as bounded contexts in strategic design are easily forgotten.
A recent article on infoq.com raised the question Can DDD be adequately implemented with DI and AOP? The arguments are valid in that infrastructure code can be best isolated from a rich domain model using AOP and DI. This is not at all different to Mats Helander’s earlier article on Looking after your domain model.
However, I cannot help the aching feeling that a large part of DDD is being lost with an often blinkered focus on the lifecycle patterns (repositories, aggregates, factories, etc.) and structural patterns (entities, value objects, services, etc.). For example, I am currently focusing a lot of energy with Tania van Niekerk (a work colleague) on the issue of designing for modularity. Modularity is deceptively complex and DDD’s strategic design (bounded contexts, anti-corruption layers, transformations, etc) is certainly helping in us finding a solution.
My take: I agree that AOP and DI do contribute in keeping infrastructure out of a domain model but, more importantly, I agree with Jimmy that there is a lot more to DDD than entities and repositories.
Hi Aslam,
I certainly agree with you and Jimmy that the important part about DDD isn’t the infrastructure – but getting the infrastructure right (as in “out of the way”) allows you to focus better on the important part (your domain). 🙂
/Mats