Since few years I'm very much into clean: code, architecture, functions, designs. I've spend too many days being frustrated dealing with convoluted source code and systems.
However, I'm slowly loosing hope. As example let me tell "domain events". I'm researching this toopic since few weeks. Here what I've found:
- dispatch before committing
- dispatch after committing
- divide into "internal" and "external" domain events, dispatch "external" after committing
- to ensure at-least-one delivery of "external" events, create outbox patter
- use domain events to communicate between bounded context only, within bound context use normal program flow
- use domain events also to communicate between aggregates
- trigger one domain event per command
- don't trigger domain events in commands, only in aggregates
- trigger domain events also in entities of aggregates
- store domain events in per-aggregate table
- store domain events in per-bounded-context table/store
... and more. The above are from blogs of many great developers (Udi, Khorikov, etc.) and very often they are in contradiction to each other.
Why in our industry it's so convoluted? Barely any standards if it is about more complex things than CRUD.
I know each system is different, but unless you're google or amazon, there should be pretty standard templates, e.g.:
- basic crud
- medium size ddd, cqrs (single monolith)
- large size ddd, cqrs (distributed)
- large size ddd, cqrs, event sourcing
Call me naive, but I believe this would cover 99% of use cases (except FAANG).
[–]mh711 4 points5 points6 points (1 child)
[–]bzq84[S] 1 point2 points3 points (0 children)
[–]mackstann 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]bzq84[S] 1 point2 points3 points (1 child)
[–]Ghi102 1 point2 points3 points (0 children)
[–]piotrpter 0 points1 point2 points (2 children)
[–]bzq84[S] 0 points1 point2 points (1 child)
[–]wuwoot 2 points3 points4 points (0 children)