31 Days of Refactoring
Refactoring is an integral part of continually improving your code while it moves forward through time. Without refactoring you accrue technical debt, forget what portions of code do and create code that is resistant to any form of testing. It is an easy concept to get started with and opens the door to much better practices such as unit testing, shared code ownership and more reliable, bug-free code in general.
Because of the importance of refactoring, throughout the month of August I will be describing one refactoring a day for the 31 days of August. Before I begin, let me prefix this series with the fact that I am not claiming ownership of the refactorings I will describe, although I will try to bring some additional description and perhaps some discussion around each. I have chosen not to list the full set of refactorings on this first post until I actually post the refactoring. So as the month progresses I will update this post with links to each of the refactorings.
First on the list is credit where it is due. The majority of these refactorings can be found Refactoring.com, some are from Code Complete 2nd Edition and others are refactorings that I find myself doing often and from various other places on the interwebs. I don’t think its important to note on each refactoring where it came from, as you can find refactorings of similar names found on various blogs and articles online.
On that note, I will be publishing the first post starting tomorrow that begins the 31 day marathon of various refactorings. I hope you all enjoy and learn something from the refactorings!
- Refactoring Day 1 : Encapsulate Collection
- Refactoring Day 2 : Move Method
- Refactoring Day 3 : Pull Up Method
- Refactoring Day 4 : Push Down Method
- Refactoring Day 5 : Pull Up Field
- Refactoring Day 6 : Push Down Field
- Refactoring Day 7 : Rename (method, class, parameter)
- Refactoring Day 8 : Replace Inheritance with Delegation
- Refactoring Day 9 : Extract Interface
- Refactoring Day 10 : Extract Method
- Refactoring Day 11 : Switch to Strategy
- Refactoring Day 12 : Break Dependencies
- Refactoring Day 13 : Extract Method Object
- Refactoring Day 14 : Break Responsibilities
- Refactoring Day 15 : Remove Duplication
- Refactoring Day 16 : Encapsulate Conditional
- Refactoring Day 17 : Extract Superclass
- Refactoring Day 18 : Replace exception with conditional
- Refactoring Day 19 : Extract Factory Class
- Refactoring Day 20 : Extract Subclass
- Refactoring Day 21 : Collapse Hierarchy
- Refactoring Day 22 : Break Method
- Refactoring Day 23 : Introduce Parameter Object
- Refactoring Day 24 : Remove Arrowhead Antipattern
- Refactoring Day 25 : Introduce Design By Contract Checks
- Refactoring Day 26 : Remove Double Negative
- Refactoring Day 27 : Remove God Classes
- Refactoring Day 28 : Rename boolean methods
- Refactoring Day 29 : Remove Middle Man
- Refactoring Day 30 : Return ASAP
- Refactoring Day 31 : Replace Conditional with Polymorphism