All code is crap
I was recently discussing how I think all code, especially mine, is crap and since this position has been and likely still is controversial, it might not be a bad idea to discuss it a bit more. This likely won’t avoid grievances and disputes, but it might save me some work in explaining myself.
I’ve never written a non-trivial amount of code that I wouldn’t find at least a bit embarrassing two years later. Partly because of my own deficiencies as a programmer, partly because our craft evolves and does so rather speedily. Even if I was as good a programmer as I would like to be, our profession would still develop and my code would eventually become crap. It would just take a bit longer than it does now. In a way, with maybe few exceptions, all code left alone is on natural trajectory to a state of crappiness.
Personally I don’t find this insulting. If anything I would be terrified to discover that my old code doesn’t bug me at all. I would see it as a signal that I haven’t developed my craft much in this time. You haven’t peaked until you stagnated .
There are also other benefits to this position. Since I find my code at least a bit dubious, I’m not enamored with it to the point, where I would find it difficult to ditch it if need be. It helps me being more detached and rational about its merits or lack thereof.
In contrast with what I just said, it also helps me from scraping it too soon. Accepting that some level of crappiness is a given, I don’t feel as much need in reformatting, refactoring or rewriting code that offends my sensibilities. I like reading pretty or even inspirational code as much as the next programmer, but esthetics are not too important. As long as code is functional, bug-scarce, maintainable and generally usable enough, it’s also pretty enough.
So if you happen to hear me insensitively remarking that some code is crap, please try to keep in mind that my completely universal belief means it’s not meant to be personal or even negative. I likely regard your code and skill higher than mine. I am truly sorry, if you nevertheless feel bad about it.