When implementing a DDD driven system (based on event sourcing) using a functional programming language (Clojure), should one separate event handler functions from aggregate functions?
In my naive implementation an aggregate would be a namespace with
- functions for handling commands which accept the current state data + command data and return event data
- functions for applying event data to the aggregates state
Is there a reason to have additional eventcommand handler functions which get the command data and call functions on the aggregate namespace? What would one put into these handlers and not into the aggregate? And why?