Dealing with CRUD data in DDD

221 views
Skip to first unread message

Daris

unread,
Jul 13, 2016, 12:08:52 PM7/13/16
to DDD/CQRS
Hello,

I am currently refactoring big application using DDD.
The application deals with renting flats etc. 

Till now I was refactoring parts of the application, which had rich behaviour and almost every data in the aggregate was needed for related logic. 
But now I came to to place, where I am having aggregates with like 90% CRUD data and like 50% never change after object creation. 
The CRUD data, contains some logic only when being initialized (validation requirements). So I have created Value Objects for them, to validate them on creation.
But after they are created, part of them just take space in the aggregate and do nothing, other part may be replaced with new VO, but never perform any kind of aggregate logic. 


I don't feel like having all this properties inside an aggregate, because it's getting huge and not really needed. 
The data containing logic and CRUD are part of the same Bounded Context. So I don't feel to split them out into separate ones. 

I could create two aggregates within same module, like
Rental (aggregate with rich behaviour)
RentalData (aggregate with CRUD)
Both correlated by same ID and created at the same request. 

But I don't know, if if is correct way to go. 
Would really appreciate any advices.

Johanna Belanger

unread,
Jul 25, 2016, 5:32:15 PM7/25/16
to DDD/CQRS
Are you also using CQRS? What about event sourcing?

urbanhusky

unread,
Jul 26, 2016, 1:43:40 AM7/26/16
to DDD/CQRS
Maybe there are some concepts in your large aggregate, which would indicate that it is actually made up of multiple aggregates, entities etc.? Also, do you even have to expose all properties on the aggregate?
For validation and logic, you may also want to look into the strategy pattern, i.e. separate the validation logic.

Ben Kloosterman

unread,
Jul 26, 2016, 11:22:38 PM7/26/16
to ddd...@googlegroups.com
This will give you the worst of both ..

Dont change CRUD style code .. pick areas and rewrite & redesign completely   . Note your agg can refer to the Crud data  via id and the handler can inject this static data if need be. 

Ben

--
You received this message because you are subscribed to the Google Groups "DDD/CQRS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dddcqrs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages