Decompose microservices: Business capability vs Domain

The commenters are right – there are some subjective definitions at play here. But there are some principles and concepts that can help reason about the different approaches. Conway’s Law It’s not strictly the original definition, but I think the distinction can be better understood with reference to Conway’s Law: Any organization that designs a … Read more

Relation between command handlers, aggregates, the repository and the event store in CQRS

The following is based on my own experience and my experiments with various frameworks like Lokad.CQRS, NCQRS, etc. I’m sure there are multiple ways to handle this. I’ll post what makes most sense to me. 1. Aggregate Creation: Every time a command handler needs an aggregate, it uses a repository. The repository retrieves the respective … Read more

What is the relationship between DDD and the “Onion Architecture”?

In my opinion – they complement each other – but from very different perspectives. Onion Architecture is all about making the Domain/BusinessLogic independant on ‘inferior’ things like data-acccess, UI, services etc. The Onion Architecture doesn’t really care how you made the domain you have – it’s adamant about protecting it from outside dependencies. Domain Driven … Read more

Difference between an entity and an aggregate in domain driven design

From domain driven design perspective DbContext is the implementation of UnitOfWork and a DbSet<T> is the implementation of a repository. This is the point where DDD and EntityFramework contrast. DDD suggests to have a Repository per aggregate root but EntityFramework creates one per Entity. So, what is an aggregate root? Assume that we have a … Read more

DAO, Repositories and Services in DDD

Repositories are – like you say – an abstraction. They originate from Martin Fowler’s Object Query Pattern. Both Repositories and DTOs can simplify database persistence by mapping persisted data to equivalent collection of entity objects. However, Repositories are more coarse-grained than DAOs by providing control of an entire Aggregate Root (AG) often hiding a lot … Read more

Domain Driven Design – how the layers should be organized?

Speaking in terms of more “classical” DDD, yes domain objects are typically not allowed anywhere outside of the domain. But it is not an absolute rule that domain objects are not used in the presentation layer. For example, Naked Objects represents a school of thought where domain objects are used directly. I myself adhere mostly … Read more

Why does domain driven design seem only popular with static languages like C# & Java? [closed]

I think it is definitely popular elsewhere, especially functional languages. However, certain patterns associated with the Big Blue Book are not as applicable in dynamic languages and frameworks like Rails tend to lead people away from ideas of bounded context However, the true thrust of DDD being ubiquitous language is certainly prevalent in dynamic languages. … Read more

Is it problematic that Spring Data REST exposes entities via REST resources without using DTOs?

tl;dr No. DTOs are just one means to decouple the server side domain model from the representation exposed in HTTP resources. You can also use other means of decoupling, which is what Spring Data REST does. Details Yes, Spring Data REST inspects the domain model you have on the server side to reason about the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)