3 ms·
This works until you refactor the new code, and the commented out code becomes out of sync with the production code it is supposed to mirror. Commented code isn
by Totoradio 13y ago
This works until you refactor the new code, and the commented out code becomes out of sync with the production code it is supposed to mirror.
Commented code isn't checked by the compiler nor by the static code analysis tools, nor by the tests, so it can become out of sync fast and silently.
- danieltillett 13y agoYes this is always a problem. With my own code I always update (and test) the commented out code first and only change the complex code afterwards. Since the commented code is for my benefit I think the extra work doing this is worth the cost. The way I work is I do any changes on the 'simple' code and only once I have something that works correctly do I try to update the 'efficiency' code. I have found if I try to change the 'efficiency' code directly then after a couple of small changes (or even one) I introduce some nasty bug. The basic approach I take is simple and working first and then any optimization second.