Re:Building a CQRS/ES web application in Elixir using Phoenix
by karmajunkie on Friday January 06, 2017 @05:19PM
(#13340830)
If your events contain the words "Create", "Update", or "Delete", or any synonym thereof, you're modeling CRUD with events and life is always going to be more complicated than it has to be for you. The names of events are data too—make them representative of the domain.
CustomerMoved(fromAddress, toAddress) is a domain event.
Re:Building a CQRS/ES web application in Elixir using Phoenix
by UK-AL on Friday January 06, 2017 @05:23PM
(#13340865)
CQRS by itself does not imply using ddd or es.
Re:Building a CQRS/ES web application in Elixir using Phoenix
by karmajunkie on Friday January 06, 2017 @05:32PM
(#13340917)
Yeah, fair enough, but if you're not using ES then the names of messages don't matter a whole lot because you don't have to live with them forever.
(Edit: ok, they matter some, in the way names of variables and apis matter.)
Re:Building a CQRS/ES web application in Elixir using Phoenix
by Haldir on Saturday January 07, 2017 @01:49AM
(#13342719)
Dino Esposito describes an "historical" crud System in a series in msdn magazine https://msdn.microsoft.com/magazine/mt703431
This is basically ES with crud. Not saying ES with crud is the best example, but for data which requires Audit Trail logic it actually works fairly well.
Re:Building a CQRS/ES web application in Elixir using Phoenix
by karmajunkie on Saturday January 07, 2017 @11:43AM
(#13344975)
Haven't read that article, but will check it out, thanks for the link.
My issue with audit logs in crud systems is that they're almost always at the row level, which is almost useless when you're trying to make sense of the audit log. An audit log of "operations"—i.e. command log—is far more useful, and trivial to implement when CQRS is used. I'm guessing that's what this article details...
So your commands should not be
UpdateCustomer
They should be
UpdateCustomerAddress UpdateCustomerEmail
Etc
For the address, just take the last one. All the business logic I can think makes this ok.