3 ms·
> “If you need new functionality but do not want to break the old just add another field and an of statement to enter a new code path.” Oof. def a(b, c, d
by fhood 9y ago
> “If you need new functionality but do not want to break the old just add another field and an of statement to enter a new code path.”
Oof.
def a(b, c, d, e=None):
if e:
is way more common in my code than it should be.
- bastijn 9y agoExactly. It’s a competition to beat the previous editor’s cyclomatic complexity score! In fact, I should have said: “If you refactor a method without increasing its cyclomatic complexity don’t bother sending for review.”
- AstralStorm 9y agoUh? Every code should be reviewed. Decreasing complexity can cause inadvertent bugs, including ones not caught by regression tests. Unless this was cheeky sarcasm in which case you shouldn't replace the previous point just add this one.
- bastijn 9y agoI think all the points in this thread are (cheeky) sarcasm :).