So, when are the right times to refactor?
- When you're changing code. Refactor to make it well-designed for its new purpose.
- When you're reading code. Every time you gain some understanding, refactor to record that understanding. Lots of renames.
- When you're afraid of code. If there's code you should be changing or reading, but you avoid because it's such a mess, then you should definitely refactor it.
Note that this refactoring is a small improvement each time, not a dramatic major rewrite. The goal is Better, not Good.
No comments:
Post a Comment