Re:Ask HN: How do you deal with legacy code?
by kazinator on Monday July 09, 2018 @05:45PM
(#17493699)
Imposing new style on legacy code can be stupid; don't do that.
You're just adding to the "activation potential" required to make a necessary fix in legacy code. Changes in legacy code should be minimal. Nobody who has to make a fix in legacy code should be asked to upgrade its style and whatnot, that is not related to the fix.
If it has its own conventions, just maintain those.
Or else, make a commitment to upgrade the legacy code to new conventions, as a separate, dedicated task, whose goal is to do it thoroughly.
The last thing you want is a hodgepodge where code that has been recently touched conforms to one set of conventions, and code that has not been touched conforms to another.
I think a good way to approach legacy code (at a high level, big picture) is to answer the question "how much of the value of what we are doing here is propped up by this legacy code?" If the fact that the legacy code works is paying your salary, respect that; maybe those people weren't idiots.
You're just adding to the "activation potential" required to make a necessary fix in legacy code. Changes in legacy code should be minimal. Nobody who has to make a fix in legacy code should be asked to upgrade its style and whatnot, that is not related to the fix.
If it has its own conventions, just maintain those.
Or else, make a commitment to upgrade the legacy code to new conventions, as a separate, dedicated task, whose goal is to do it thoroughly.
The last thing you want is a hodgepodge where code that has been recently touched conforms to one set of conventions, and code that has not been touched conforms to another.
I think a good way to approach legacy code (at a high level, big picture) is to answer the question "how much of the value of what we are doing here is propped up by this legacy code?" If the fact that the legacy code works is paying your salary, respect that; maybe those people weren't idiots.