Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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(); }



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: