News for hackers. Stuff that matters.
Re:The anti-if campaign by dspeyer on Monday October 12, 2009 @09:09PM (#878043)
I've always found a good principle to be that functions should do something and classes should be something and it should be possible to explain what that something is in a short sentence. If an if or switch statement can become a map of function pointers or a polymorphic dispatch without violating this principle, go for it. If not, use "if". Even if you have to use a lot of "if", it'll make your code make sense.

A related principle is that a function's argument list should never be longer than its body.

There are no comments on this comment yet.