Skip to main content
added 2 characters in body
Source Link
Witek
  • 237
  • 3
  • 6

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?

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 event 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?

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 command 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?

added 2 characters in body; added 21 characters in body
Source Link
Witek
  • 237
  • 3
  • 6

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 eventscommands 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 event 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?

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 events which accept the command data and return event data
  • functions for applying event data to the aggregates state

Is there a reason to have additional event 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?

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 event 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?

Source Link
Witek
  • 237
  • 3
  • 6

DDD: Event handlers and aggregates in functional programming

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 events which accept the command data and return event data
  • functions for applying event data to the aggregates state

Is there a reason to have additional event 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?