News for hackers. Stuff that matters.
Re:Linear code is more readable by BenFrantzDale on Friday September 15, 2023 @07:41AM (#37521511)
If the sub-functions could be reused and people would be tempted to change them, then that’s what your tests are for. In fact, it’s often tricky to test the sun-function logic without pulling them out because to write the test you have to figure out how to trick the outer function to get into certain states. Follow the Beyoncé rule: if you like it: put a test on it. Otherwise it’s on you if someone breaks it.

There are no comments on this comment yet.