Refactoring: Improving the Design of Existing Code (2nd Edition) Cover Book cover copyright Martin Fowler

Overview

This chapter explains several refactoring methods for simplifying conditional logic.

My One Takeaway

Another two takeaway chapter:

  1. Decompose Conditional is a huge win for me for readability
  2. “I often find I use Replace Nested Conditional with Guard Clauses when I’m working with a programmer who has been taught to have only one entry point and one exit point from a method. … Clarity is the key principal: If the method is clearer with one exit point, use one exit point; otherwise don’t.” I love “Clarity is the key principal” and it should be on every blackboard in every programming class ever.

Like this post? Don't forget to follow us on Twitter and Facebook for updates.