3 ms·
> knowing what I am doing This code is a mess, I don't understand what it's doing is very different from I get what it's doing but this code is a mess. The fi
by magicalhippo 2y ago
> knowing what I am doing
This code is a mess, I don't understand what it's doing is very different from I get what it's doing but this code is a mess.
The first should probably be a strong sign you should not start rewriting the code, while the second can be a decent position to consider rewriting it.
- MereInterest 2y agoI think I’d distinguish between rewrites and refactors. A rewrite starts from a blank slate, where a refactor starts from the previous version. Being unable to understand the code in its entirety does not mean that somebody is unable to understand pieces of the code. Refactoring those pieces into easier-to-understand portions can be done, even when the end-to-end flow is still being contemplated.
- magicalhippo 2y ago> Refactoring those pieces into easier-to-understand portions can be done Right, but the main point still stands I think, that if you don't understand the full code, you run a risk at introducing bugs when refactoring portions of it. Code that seemingly does nothing might in fact do something due to non-local effects, ie global variables in disguise, and other pitfalls. A "favorite" is using reflection to modify some non-local variable rather than accessing it directly, making it very difficult to find during code searches. Sometimes these bugs can be glaring, other times they can be more subtle and only be detected once they've inflicted significant damage to customer data.