When we talk about the algebra of an operation, we talk about the signature of the operation, and how, starting from the input, we can just "follow the types" to lead to the implementation of that operation.
Consider the following operation generateTrades
as part of a domain service TradingService
. The idea is to generate all trades that happened on the day (input to the operation) and executed by the user (input to the operation) in the back-office of a securities trading organization.
In the example below, note the following 2 principles that form the core of the algebraic modeling:
- The sequence of steps mentioned in the specification of the method as comments and correspond one-to-one to the types of the operations used in implementing
generateTrades
. I have annotated the steps in the implementation below. - The implementation of
generateTrades
is completely decoupled from the implementation of the operations likequeryExecutionsForDate
, `getAccountNoF