Winning the Game With CQRS/event Sourcing and BDD
Yes !! I did it !!!
I have been making a few attempts to combine BDD with CQRS/event sourcing, since they seem to make a perfect fit.
After mailing to the DDD/CQRS newsgroup for a few times, I finally managed to make something presentable… this is the BDD part for the domain :
And this is the resulting output after running the console runner
This is the context, notice how setting up the interpreter usually only takes a single line (i.e. register an event, execute a command, or check something)
And this is the implementation of the domain class
And it’s domain handler
As wel as a view updater (in reality this view store would be queried be a winform or webform directly)
Please do note that the current Event Store and Aggregate store are not persisted; IRL you would have to persist the event store (forward write-only), and probably some snapshots from your aggregate root as well (maybe using a bigtable); this should be easy to add, I might do this in a later phase….
You can find the full sourcecode in this zip:
I uploaded the sourcecode to github : http://github.com/ToJans/CQRSNode
I also added (currently synchronous) a node.js -like implementation…