3 ms·
I don't see the need for the invasive change. Given the problem that he had I would have written a new function that returned the more complex data structure,
by btilly 17y ago
I don't see the need for the invasive change. Given the problem that he had I would have written a new function that returned the more complex data structure, converted the old function into a wrapper around the new one, then called the new function in my new code.
Much simpler. Much safer. Much less chance of breaking existing code. (Decent unit tests could help verify this.) And you avoid duplication of logic.
If I wished to convert existing code to use the new function, I could do that at my leisure. Furthermore if someone happens to be developing code in another branch or at another site which expects the old function to be there, I don't break them.
- AndrewDucker 17y agoIf you're refactoring a lot then your method leaves you with huge amounts of extra code, which makes maintainability much harder, because you've got multiple levels of indirection.
- btilly 17y agoIf even your internal modules are clearly separated into public interfaces and internal stuff, then most refactorings won't need that level of care.