Monday, August 3, 2009

When to Refactor

It's common knowledge that you don't write code in a software project to solve future problems. Don't implement code that is not needed.

It occurred to me that the inverse is true for refactoring. I will not delay a refactor because we expect to have a requirement that will make it obsolete. You never know which features/tasks will be canceled or delayed. You should ask yourself, "How long am I willing to support this ugly code?"

1 comment:

Don Branson said...

It's common knowledge, too, that there's an exception to every rule. I've seen at least a few occasions where common sense wasn't in play when this rule was applied, and significant rework was needed, when it could have been avoided with a little forethought. It's important to engage our brains when applying these rules.