Skip navigation.

If statements and duplication

If statements and duplication

I'm a big fan of hearing little stories that lead to little lessons. Being good at a craft requires knowing a whole slew of little lessons and having your mind be primed to pull them into action. Here's a nicely put little lesson from Kevin Rutherford.

Therefore it seems to me that there are two kinds of conditionalstatement in a codebase: The first kind tests an aspect of the runningsystem's external environment (did the user push that button? does thedatabase hold that value? does that file exist?). And the second kindtests something that some other part of the system alreadyknows. Let's ban the second kind...