Repository Pattern: how to Lazy Load? or, Should I split this Aggregate?

Am I misinterpreting the intent of the Repository pattern? I’m going to say “yeah”, but know that me and every person I’ve worked with has asked the same thing for the same reason… “You’re not thinking 4th dimensionally, Marty”. Let’s simplify it a little and stick with constructors instead of Create methods first: Editor e … Read more

Value Objects in CQRS – where to use

Ok I’ve changed my mind. I have been trying to deal with VOs a bunch lately and after watching this http://www.infoq.com/presentations/Value-Objects-Dan-Bergh-Johnsson it clarified a couple of things for me. Commands and Event are messages (and not objects, objects are data + behavior), in some respects much like DTOs, they communicate data about an event and … Read more

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

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

How do Repositories fit with CQRS?

I’ve read about CQRS systems that maintain a simple key value store on the command side to represent an application’s state, and others that merely correlate messages (using some sort of saga) and utilise the query store to represent an applications state instead. Either way there’ll no doubt be a persistence technology involved with these … Read more

CQRS Commands and Queries – Do they belong in the domain?

Commands and Events can be of very different concerns. They can be technical concerns, integration concerns, domain concerns… I assume that if you ask about domain, you’re implementing a domain model (maybe even with Domain Driven Design). If this is the case I’ll try to give you a really simplified response, so you can have … Read more

What is a practical way to model lookup tables in Domain Driven Design (DDD)?

You may want to look into the concept of Command Query Separation. I wouldn’t worry about typed repositories for lookup values, but I’d still probably use DTO type classes over datasets etc… You may want to spend some time reading Greg Young’s blogs starting from this one to the present. He doesn’t talk about filling … Read more