This post is largely my thoughts on Andy G's Algorithms as Objects, specifically in relation to simulation algorithms. The original article makes a case for Transforming complicated algorithms into objects in order to deal with five code smells:
- Code that is long or deeply nested
- Section comments
- Excessive closures
- Single-purpose helper functions polluting the namespace
- Lots of state being passed between functions