News for hackers. Stuff that matters.
Re:Why bad scientific code beats code following “best practi... by eecks on Sunday August 28, 2016 @03:06PM (#12377947)
Small functions (less dependencies) are easier to test
Re:Why bad scientific code beats code following “best practi... by quotemstr on Sunday August 28, 2016 @03:29PM (#12378065)
Here's another bit of heresy: testing isn't everything. Very fine-grained test suites frequently break when the structure of code under test changes even when the new code still does its job. In the limit, it's the equivalent of just breaking if SHA256(old_code) != SHA256(new_code).

Very short functions, I've found, encourage this kind of over-testing and just add friction to code changes without actually improving system reliability.

You're better off testing at major functional boundaries, and if you do that, the length of functions matters less than the interface major modules provide to each other.

Re:Why bad scientific code beats code following “best practi... by Swizec on Sunday August 28, 2016 @03:45PM (#12378152)
> You're better off testing at major functional boundaries, and if you do that, the length of functions matters less than the interface major modules provide to each other.

Otherwise known as integration testing, which is far more useful than unit testing because bugs, especially regression bugs, more often occur in the system, than in specific functions.

You can have as many unit tests as you want, but until you have integration test, you have zero coverage for the really complex part of your code.

Unit tests are great for algorithms though.

Re:Why bad scientific code beats code following “best practi... by JulianMorrison on Sunday August 28, 2016 @04:51PM (#12378465)
Small functions are generally uninteresting to test. As smallness approaches "one liner", you're just verifying the compiler. Yes, 1+1 == 2.