Code Refactoring 6

Code Refactoring 6In 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.

The code follows the video, to help you learn.

If you like videos like this, it helps to tell Google [googleplusone]

Code from the Video

TurnConditionalIntoMethods.java

ReplaceConditionalWithPoly.java

Leave a Reply

Your email address will not be published. Required fields are marked *