kgrzybek / sample-dotnet-core-cqrs-api

Sample .NET Core REST API CQRS implementation with raw SQL and DDD using Clean Architecture.
https://www.kamilgrzybek.com/design/simple-cqrs-implementation-with-raw-sql-and-ddd/
MIT License
2.88k stars 646 forks source link

Why you choose not doing event sourcing? #2

Closed Narvalex closed 4 years ago

kgrzybek commented 5 years ago

In my opinion for complex-writes we can use traditional approach too. Event Sourcing is great for example when we have a lot of write operations or we want to have full history of our system. Of course it is not free, each solution has pros and cons.

In most systems you don't need ES so this why I wanted to show people how it is possible to create CQRS with DDD using traditional approach - I think it will help more people. Especially, when there are a lot of legacy systems with anemic domain models and refactor to rich domain model using traditional approach is more easier than to ES.

Narvalex commented 5 years ago

Well, I think that is not that hard to do event sourcing, and the benefit of replaying all events to easily create new read models is something that you can not simply achieve with the traditional approach. Actually is a lot harder to introduce a new read model in a CQRS system when you have a lot of data already.

jkosters commented 4 years ago

@Narvalex in the real world it's not always possible to refactor existing code all the way (because of time or some other external factor). I for one am gratefull for working examples like this. It helps us make a big move forward, and gives us an option to get the whole team aboard and which isn't "do it all over again".

Narvalex commented 4 years ago

Fair enough. Still, in green field projects, do not hesitate to start an event sourcing journey. I will be highly rewarded if you endure all the way to a good and fun codebase to maintain.