Domain-Driven Design
> >
SideEffectFreeFunctions

Excerpted from DomainDrivenDesignBook

Definition: An operation that computes and returns a result without observable side effects.

Problem: Interactions of multiple rules or compositions of calculations become extremely difficult to predict. The developer calling an operation must understand its implementation and the implementation of all its delegations in order to anticipate the result. The usefulness of any abstraction of interfaces is limited if the developers are forced to pierce the veil. Without safely predictable abstractions, the developers must limit the combinatory explosion, placing a low ceiling on the richness of behavior that is feasible to build.

Solution: Place as much of the logic of the program as possible into functions, operations that return results with no observable side effects. Strictly segregate commands (methods that result in modifications to observable state) into very simple operations that do not return domain information. Further control side effects by moving complex logic into ValueObjects when a concept fitting the responsibility presents itself.

See also: SideEffect


SideEffectFreeFunctions is mentioned on: SideEffectFreeFunction | MessagesByTopic



VeryQuickWiki Version 2.6.3 - HTML Export