Hi all,
Im currently thinking about enhancing the events with information
that's of interest when showing the events in a console that monitors
all events. This would require including data in the domain object
that's not necessary for keeping state in the traditional way.
Example:
AGGREGATE ROOT
Project (name="My Project", but is not included in the domain object
because not required for the state)
COMMAND (for Project):
AddMember(name = "Peter Parker")
EVENT:
MemberAddedEvent(name = "Peter Parker")
Now you want to produce an informative log message from the event
("toString()" method of the event):
"Added member 'Peter Parker' to project 'My Project'"
But the name of the project is currently not part of the domain
aggregate root "Project". Is it OK to include the name of the project
in the aggregate root domain object? I'd say yes because producing a
good event message can be seen as part of the domain object's state.
What do you think?
Cheers,
Michael