Testability and Functional Programming
Christian Sunesson (via Jonathan Rentzsch):
The funny thing is that the OOP world have found one way to manage the complexity and the code-bases that grow ugly: They are using unit tests, and practice the art of writing testable code. […] What they are doing is that they are making as much of their code as possible to be side-effect free and placing all that code in one method so it can be called from a unit test. They are concentrating side-effects to well-defined places, carefully avoiding mixing side-effects and testable/test-worthy logic. What they are doing is that they're reinventing functional programming.
I think he’s right. To a first approximation, code that’s more functional is easier to get right, easier to test, and easier to maintain.
1 Comment RSS · Twitter
[...] Michael Tsai – Blog – Testability and Functional Programming – interesting. [...]