4 ms·
It is good to be humble, but better to be realistic. Why the parent's self-deprecating sentiment is so popular is beyond me. "I hate my own code" seems to con
by koningrobot 16y ago
It is good to be humble, but better to be realistic. Why the parent's self-deprecating sentiment is so popular is beyond me. "I hate my own code" seems to confirm the "to each their own" view, but some ways of doing things really are objectively (but perhaps not measurably) better than others.
When I write code, I write it as well as I can, and I will usually be happy with the result. Then I write more, and as the nature of the problem I'm trying to solve becomes clearer to me, I think of better ways to model the problem and the solution. Later, when I come back to the older code, I will rewrite it to fit the new style.
I am not, at that point, unhappy with the old code. It was written with great care. The fact that I changed my perspective and will proceed to rewrite it with great care does not change that.
I am unhappy with code on a daily basis, but rarely my own. I fully and proudly own up to this, and my intention to rewrite other people's code is not some kind of primitive urge to exercise my power.
It's simply that most code isn't written with care or foresight at all. Those who write the code usually protest the rewrite with "why change it if it works?", but with that kind of thinking you might as well write everything in assembly.
I write code with great care, and I imagine that all who do so would gladly accept suggestions for improvements. That's the kind of humble I think we should be shooting for.
- dagw 16y agoThe problem is that many people aren't given the time and circumstance needed for them to write code as well as they can. When a feature needs to be demoed on Friday morning for the large contract to be closed you do what needs to be done to get something that runs and promise yourself you'll fix it when you have time (yet knowing that that time may never come). You know what you did is objectively bad, but you know that to do it objectively better would take longer (probably because it would require you to fix some other rushed part of the code produced under similar circumstances).
- psadauskas 16y agoI'm always learning. When I come back to some code I've written before, I'm never happy with it because its missing an idiom that I learned in the meantime that would make it simpler. Or, I didn't completely understand the problem, and some of the assumptions I made at the time turned out to be wrong. Or, it's more complicated than it needs to be. Or, its too simple, and I need to add more functionality. Code is never finished, it's just released. Then modified, and released again. Then abandoned.