2017-11-12 17:02 GMT+08:00 Miroslav Trninić <
miroslav...@gmail.com>:
> My understanding is that events are just one way to capture aggregate state
> (mostly using even sourcing). But we can have aggregates without events. For
> example value objects that carries aggregate state can be attached to
> aggregate by using factory method.
Sure, but that's just another way to produce events, and it's more
complex. Let me outline a few different ways to slice this:
* with pure eventsourcing, when an aggregate receives a command you
build up current state by replaying past events. Process command,
output is events.
* in my case, when an aggregate comes in I load current state (ONLY
state needed to make decisions, not the full possible state) from read
model into a value object and attach it to the aggregate. Process
command, output is events (which update the read model so the load
works)
* in a CQRS, non eventsourcing case, when an aggregate receives a
command you load current state from the database read model. Process
command, output is either:
1) events, use them immediately to update read model, then throw events away
2) updated value state. Some process has to figure out the diff and
apply to read model (this is still events, just automated), or you
have to update the entire value into the database (this is the worst
option in my view)
Of all the possible options I would consider CQRS option 2) to be the
most complex and least useful. CQRS option 1) is the most
straightforward if you don't want to add an event store to your
infrastructure, and just stick to regular database as infrastructure.
Makes sense?
In any case, these are details compared your observation that we can
apply process and systems theory to this field, which is the important
point.
/Rickard