a) Assuming we don't use IoC, where should handlers be register? In an Application layer?
b) Perhaps a useless question, but is part of the reason for such a design where handler's Handle
method takes Domain Event as an argument because this way we explicitly state which Domain Event is being handled and it also makes code easier to understand if arguments are expressed in terms of a domain model?
c) From
A domain event is a role, and thus should be represented explicitly
What does the author mean by "domain event being a role"?
Thank you
UPDATE:
a)
In IoC terms with would be the composition root of your application.
I don't quite understand what you're tying to convey here?!
b)
Yes, although I don't fully understand your question. What would be the alternative?
I wasn't implying that the design Udi came up with could have an alternative to passing events as arguments, I was just curious whether this design also brings the benefits I mentioned under b)
c)
The concept of a role is based on the idea that a single object can play multiple roles depending on the context.
I haven't read chapters 16 and 17 ( Evans book ), since I doubt I will be involved in large-scale projects anytime soon, but to my knowledge Evans's book doesn't cover this subject ( I'm not implying that this is not important topic, I'm just curious if perhaps I somehow managed to overlook this topic )?