The command side of things behaves just as any standard ORM app
would. No need to use the query side at all when processing commands.
-- Udi Dahan
From:
domaindrivendesign@yahoogroups.com [mailto:domaindrivendesign@yahoogroups.com] On
Behalf Of Jesper De Temmerman Sent: Tuesday, July 14, 2009 5:28 PM To: domaindrivendesign@yahoogroups.com Subject: RE: [domaindrivendesign] Re: Presentation Models
Thank you Michael and Udi, this makes things a
little clearer.
Assuming that we take the 'domain object contains internal state'-approach, how
would this state get into the domain object? The query side contains all the
code to fetch state from persistent storage and apply the events, so we could
call that when creating a domain object to get the state.
At the same time, something tells me that this is not a good way to work
because it mixes the command and query bounded contexts. With the only
advantage being that we can call existing code the added complexity is probably
not worth the cost.
When firing events from the domain objects I assume that there will be a class
that intercepts these events, persists them and routes them to the query
repositories for 'processing' to update the query-data?
> Jesper,
>
>
>
> While the query side exposes state, it's not that the command side doesn't
> have its own state.
>
>
>
> So, to this:
>
>
>
> "It does not make sense to actually set the address in the customer
object
> because it should not contain the state"
>
>
>
> It actual makes perfect sense (unless you're doing the commands-as-state
> pattern that Greg is talking about).
>
>
>
> -- Udi Dahan
Thank you Michael and Udi, this makes things a little clearer. Assuming that we take the 'domain object contains internal state'-approach, how would this state...
Jesper, I think you've taken things a bit too far. The command side of things behaves just as any standard ORM app would. No need to use the query side at all...
Hi, "It does not make sense to actually set the address in the customer object because it should not contain the state" Why. Well only if you don't have a...
"I said the difference is". Should have said one of the differences has there are more. Especially the purpose is different, but from the point of view of...
I also wrote: "One cannot talk about Event Sourcing with a source IMHO." Should have been: "One cannot talk about Event Sourcing WITHOUT a source IMHO." What I...
So, incorporating these changes this would mean we're doing the following ChangeUserEmailAddress-command is determined as being 'valid to use' for the current...
In your example, does the domain object also publish each event as it occurs or does your domain service republish them after saving them to the repository? I...
Hi Jesper, Your steps seem quite complicated, but maybe I'm missing something. How about this: - Command picked up by command handler (happy with everything...
The purpose of the initial UserEmailAddressChange-event was to give the domain object something to respond to that would work for both actual changes and...
Seems to me that the additional event you introduced is a solution for a specific problem rather than the default approach. So in general what Jesper wrote is...
Hi Jesper your steps seam quite similar to mine. The problem I'm having in my case is related to: *"*Everything that should only occur when the command is...
Humm it would work if events where played against a domain model retrofited to the same instant when the event occurred and was processed. Probably a snapshot....
Events are state changes... When replaying you will by definition be in the same state as when the event originally happened. You never take actions on the...
I wrote: "I think we are negleting that selection is also part of the business logic." Here I jumped scope. The selection I was refering is at the first run of...
Shouldnt the event be carrying forward the *result* of that computation? or were you planning on recalculating it everywhere? Why is this an issue with...
Clearly my english skills are not that good sorry. I too when I read it the second time can see that it can be interpreted in all sorts of ways. I'll try to ve...
Greg, Let's deal with each context separately: 1. Replaying events for the purpose of bringing another system (or newer version of the same system) to a...
... to > happen (or that has been requested to happen), like a command. It's a > particular event that has meaning in your domain (eg, to steal a tired >...
... Interesting - I had never thought of them as an explicit request before - always as something that had already happened that someone may be interested in....
command[0..1:1]command-handler[1:1]domain-event[1:1]domain-handler[1:1]domain-state-change-event They all seam similar when looking at their data, but their...
... reaction to a lot of different domain events, and at the same time a domain event can come from a lot of different commands. But in most systems you...
... been > espousing - they look a lot more like commands and he's clearly > storing the event first, and then reading it to process it (which is > more what...
... Ah, I think you misunderstood me there, not sure where the compensating actions came from - I was talking about the command being rejected because it...
Jesper I begin to see the mapping between your model and michael's model. To sum up. Your model : Command -> CommandHandler -> DomainEvent -> DomainHanlder ->...
It's definitely Greg's model :-) Or at least my (and possibly others') understanding of it. Also, I'm quite happy with side effects happening in entities...
... Oh just reread this, I meant that in the sense that it's not "Michael's Model" :-) Not in the sense that this is definitely how Greg is doing things -...
... during > command processing (even with external services if need be). For me, > the processing of a command (or you could just think of it as an > action...
... Huh-wha? State-change events listening to side-effect functions? I'm a little lost. I was just saying that I'm happy with causing side effects during the ...
... (to >> clarify: not the bounded context but the situation that caused the >> change)? > > Huh-wha? State-change events listening to side-effect functions?...