News for hackers. Stuff that matters.
Re:Good Software Development Habits by mrighele on Monday November 18, 2024 @05:09AM (#42171152)
A wonky parametrization is probably sign that you are refactoring at the wrong level. If you have something like

function doStuff(flag: boolean) { // do some stuff if (flag) { // do stuff a } else { // do stuff b } // more stuff }

you may want to do two implementations that are something like

function doStuffA() { doSomething(); doStuffSpecificForA(); doSomethingElse(); }

and

function doStuffB() { doSomething(); doStuffSpecificForB(); doSomethingElse(); }

There are no comments on this comment yet.