Hi all,
In a project I’m working on, I’ve gone down the route that says a ddd entity/value object should never be created in an invalid state. Given this wher should validation for things like arguments not being null be placed? In the constructor or in a factory, or in a validation object?
Given I am also using CQRS, it seems like I’m going to have the same validation in several places.
What are people’s thoughts on this?
Kind regards
Sean.
Hi,
That’s where I was going, how do you handle a situation where you might want to unit test this, say you have a FutureDate value object that only allows dates in the future.
If this was a class I would pass in an interface that gave access to the time.
I appreciate it’s not advisable to pass dependencies in to domain objects, would a factory be more appropriate, if so where should this live?
Cheers
Sean.
--
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.
Hi Brian,
Thanks for the clarification.
Thinking about this further, I can get around this using value objects.
Cheers
Sean.