0

After much reading and some attempts to implement DDD, I think I understand what people mean when they say the concept was developed for complex domains.

I usually develop web applications for small and medium businesses, usually the interactions are just CRUD application and tables in HTML, which goes beyond this are some validations before inserting the data into a database.

I was reading about CQRS on Martin Fowler's website and a phrase caught my attention: "CQRS is suited to complex domains, the kind that Also benefit from Domain-Driven Design.".

So my question would be how to analyze the complexity of the software?
When applying DDD worth?
Worth applying DDD in software for small and medium complexity?

Thank you!

Leo Cavalcante
  • 2,327
  • 2
  • 22
  • 30

1 Answers1

2

Often even the simplest applications on the surface can turn into something complex. Right now I'm always trying to apply some basics of DDD (at least tactical patterns) and if I see that project is going out of hand, then I start to map contexts etc.

Complexity of software can be analyzed by analyzing your understanding of bussiness domain.

Rafał Łużyński
  • 7,083
  • 5
  • 26
  • 38
  • You end up having to have a repository for each entity? So just turning every entity in an aggregator root? That was my main problem. I usually need a repository for each table in the database and when these tables have relationship I did not know what to do, since injecting the repository in "aggregator root" is a bad practice. – Leo Cavalcante Sep 10 '14 at 18:42
  • Something simple that I want to be `category.getNews()` I can not, because my root aggregator Category not know how to deal with the root news aggregator. So I end up having to do: `category.setNews(newsRepository.findByCategoryId (category.getId()))` and if you have a list of categories have to use a `foreach` this operation. – Leo Cavalcante Sep 10 '14 at 18:43
  • Unfortunately DDD slows me in projects I usually must develop, not helps me :( – Leo Cavalcante Sep 10 '14 at 18:45
  • 1
    DDD was also slowing my projects before, but only because I didn't understand it and I lacked experience with using it. Right now when I know what to do, it's going as fast as earlier projects if not faster. I have repository for every AR, not entity. As for categories, if news can have only one category, then make reference by ID value object in news AR `CategoryId(category_id)`. Then in news repository you can make method `newsRepository.getNewsFromCategory(category)` and return list of news. – Rafał Łużyński Sep 10 '14 at 21:02