In this part of the Code Refactoring tutorial I’ll focus on conditionals. Conditional statements can very often make your code very hard to read.
Here we’ll clean up conditional statements by extracting them into methods. We’ll look at how important naming can be to writing understandable code. We’ll take a look at guard clauses and when to use them. Then we’ll see how polymorphism can eliminate conditionals all together.