Revisiting the Refactoring Guidelines
Refactoring Design
In Lesson 6, Refactoring, we mentioned simple design refactors. We can now expand these with design patterns. Once we know how to use patterns correctly, we will be able to refactor code toward them when it makes sense to do so:
- Extract private methods from deep conditionals.
- Extract smaller private methods from long methods, and encapsulate cryptic code in private methods.
- Return from methods as soon as possible.
- Encapsulate where we find missing encapsulation.
- Remove duplication.
- Refactor to patterns (New).