3 ms·
> If the code still works even after the change, my model of the code is wrong and it was succeeding for the wrong reasons. If someone else wrote the code, you
by kazinator 2y ago
> If the code still works even after the change, my model of the code is wrong and it was succeeding for the wrong reasons.
If someone else wrote the code, your model of why it works being wrong doesn't mean anything is wrong other than your understanding.
Sometimes even if you wrote something that works and your own model is wrong, you don't necessarily have to fix anything: just learn the real reason the code works, go "oh", and leave it. :) (Revise some documentation and write some tests based on the new understanding.)