Book cover copyright Martin Fowler
This chapter explains several refactoring methods for simplifying conditional logic.
My One Takeaway
Another two takeaway chapter:
- Decompose Conditional is a huge win for me for readability
- “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.