I understood that " transient " implies read only, so we should not be making any state changes to the orderitem entity? Please correct me if i am wrong... i guess i am.Where can i get more info on what transient implies in a ddd context ?Thanks
Sudarshan
On Wednesday, 15 August 2012 20:08:57 UTC+5:30, rebo wrote:
Within the command handler can you not just have a generic getOrderItem method on your AR. You can then make the relevant calls to that object.i.e.orderItem = order.getOrderItem(orderId)orderItem.changeTitle;As this is just a transient reference to the orderItem within a transaction you should be ok? And the orderItem can still ask its AR parent if any aggregate invariants need to be enforced.
On Wednesday, 15 August 2012 15:25:22 UTC+1, sudarshan wrote:
If i have designed an AR like the below, how do you think i should go about say updating a property in one of the order line objects ?For Example how can i change the title for one of my order lines (example question)This is the Order Aggregate Root
...
the way I see it is although an aggregate root is responsible for the life cycle of entities within, that doesn't mean that it should be the exclusive interface ( other than returning a specific entity) to all methods called on any item within the aggregate.
the whole reason for DDD is to provide some structure to OO applications. part of OO is being able to call methods on the relevant object. and if change order item title is more relevant for a orderitem entity that it's aggregate root then I will call it on that object.
I don't think this is the reason for ddd but instead perhaps ddd is a prism through which to look at things that can make some things more clear, like the light spectrum, this does not mean the spectrum represents the beauty of light or that you see the whole spectrum though the prism.
I guess the disadvantage to not calling via the AR is that the command handler has to be aware of AR entity accessors and entity methods but for me that's not a major issue as I consider the commas handler part of the domain. For me the interface to the aggregate is the command handler itself.
Do people usually consider this while designing their ar's ?