that “smells” 3. Determine how to simplify this code 4. Make the simplifications 5. Run tests to ensure things still work correctly 6. Repeat the simplify/test cycle until the smell is gone
you do something, you just do it. The second time you do something similar, you wince at the duplication, but you do the duplicate thing anyway. The third time you do something similar, you refactor.” The Three Rule, Marting Fowler