Monday 3 June 2013

Dual functional & OO interfaces for program decomposition into stateless & stateful parts.

If you expose complex logic through a functional interface, it is (much) easier to test due to it's statelessness and lack of access controls.

On the other hand, parts of the program that are necessarily stateful are best handled via OO interfaces, as this allows us to limit the number of possible state transitions. Access to the stateful variables themselves is restricted (as private), and state transitions are allowed only via a limited number of (public) methods.

Management of finite resources (file handles, memory etc...) is a simple stateful part of the program, and is handled neatly by RIAA.

No comments:

Post a Comment