About Code Modularity

Break out logic into separate functions, rather than mixing logic into stateful and side-effect-filled code. Separating stateful code and code with side-effects into smaller functions makes them easier to mock out and unit test without side-effects.

Michael Foord (@voidspace)

Tips and Tricks Programming Wisdom Refactoring Optimization Python 3 JavaScript