3 ms·
While that's undoubtedly part of it, I'd say there's definitely other advantages too. For instance, as danso says at [http://news.ycombinator.com/item?id=53324
by EvilTerran 14y ago
While that's undoubtedly part of it, I'd say there's definitely other advantages too.
For instance, as danso says at [http://news.ycombinator.com/item?id=5332448 http://news.ycombinator.com/item?id=5332448], it forces orthogonality, because you have to think how a function can be tested independently of the external objects that may use it; if you have to write your code with automated tests in mind, it's almost inevitably going to be more modular, because poor modularity turns writing those tests into a massive pain.
Also, the tests can act as something like a formal specification; in the process of writing tests, unspecified edge cases may become apparent that weren't noticeable in the natural-language spec.