Wednesday, March 14, 2018

The Urge to Refactor

Refactoring

The urge to re-factor your code base whenever you find, a new, more elegant, method to accomplish something that you're already written, can be strong.

Frequent refactoring is a vital part of keeping your code base fresh and current.  Also, when you come up with a new way to do things, refactoring can improve the performance and efficiency of your application,

Also, when your current model for doing things doesn't work, and you meet that challenge, refactoring can cut down on the one-offs that occur in code.

For the developer, code continuity improves readability and maintenance.  design alignment advances object orientation, and every performance enhancement, no matter how small at the unit level, improves the overall user experience.

For the product owner, more efficient code reduces operating costs, and readability reduces maintenance costs.  Better models are better. (thus the label)
And anything that improves the overall user experience... well, it improves the user experience.  Users pay the bills.

But, on the other hand...

Refactoring requires a lot of time and testing to accomplish properly.  Also, there's the possibility that your new solution may leave you with a one-off somewhere else.  And, it doesn't improve your feature list.  Your users probably wouldn't notice it., so the perceived value is minimal.

If the re-factor improves elegance, but not performance... or worse, degrades performance, then it's not a good investment.  readability is a strong variable, but it is a secondary variable.  At the end of the day, your Meat and Taters get delivered in the space between what the user pays you, and what you pay the platform.

IMHO


So, a balancing act is called for.  If the one-off is going to be visible to the user, or disruptive to usability in general, then the refactoring is probably called for, with high priority.  But don't let the perfect be the enemy of the good.

If it's a performance enhancement, then schedule the re-factor as a planned improvement, just like a new feature.  And then prioritize it over new features, especially if the new feature would benefit from the redactor. Promote the re-factor as a performance enhancement.  Besides, if the re-factor doesn't improve performance, then why are you doing it?


No comments:

Post a Comment

Setup to Succeed

I've worked for both good and bad companies in my career.  Some companies treated their customers well, but treated their employees poor...