News for hackers. Stuff that matters.
Re:Push ifs up and fors down by jackblemming on Wednesday November 15, 2023 @07:58PM (#38284620)
“Put ifs were they minimize the net total Cyclomatic complexity”

This is exactly what the factory design pattern is trying to achieve. Figure out the type of object to create and then use it everywhere vs a million different switch statements scattered around.

Also don’t create batch functions unless you need to. Functions that work on a single item compose better with map-reduce.

There are no comments on this comment yet.