- Can the code be refactored?
- Do you need a seam?
- extract methods using protected not private that use the seam.
- Do you need a seam?
- Create Tests
- Start with the deepest branch to shortest branch
- Keep changes small and consistently retest.
- Remove complexity
- Methods should not have more than 10 lines of code
- Replace conditionals with strategy pattern.
- Remove local variables
- Remove comments – use descriptive method names.
- Remove cryptic or clever code,
- Remove abbreviated code
- Refactor with dependency injection
- Refactor using SOLID
-
Single Responsibility Principle (SRP)
-
Open Closed Design Principle
-
Liskov Substitution Principle (LSP)
-
Interface Segregation Principle
-
Dependency Inversion Principle
-
- Refactor using other design principles
-
Encapsulate what changes
-
Don’t Repeat Yourself (DRY)
-
Don’t look for things. Ask for things. (Dependency Injection)
-
Favor Composition over Inheritance
-
Program to the Interface not to the Implementation
-
Delegation Principles
-
Last updated 2/11/18