Chasing a link via Twitter, I recently read Your code sucks. Having gone over a lot of other people’s code myself, and writing code for long enough to have a good history of my own work to go over, it resonated with me.
I recently had the mispleasure of debugging a piece of code that I wrote almost ten years ago. It was, in many ways, painful to read. Although I still use the same language as back then, things have way evolved: The language, for one. Development tools. (Well, not mine: I still use Emacs.) But most of all: My knowledge and my mental horizon in programming. I’ve looked at various other things to enrich my skill set, bringing to my own coding habits tools that work well in other languages. I also got to understand the tools I use better (especially database tools – those are so rich, and so few tools ever really use them). So, with that experience in mind: My code does suck. But I much prefer something that I wrote ten years ago to be painful to read, because it means that I have learned a lot. Even though I feel great satisfaction with the things I write today, I am sure that in another ten years time, I will look back at todays work and feel a slight sensation of being ashamed of what I did.
And this humbles me in reading other people’s code. It does not hurt to assume competency in others; they may have different routes they take in solving problems. But if one gets to think like they do, understand why they wrote the code the way that they did, that certainly may lead to your taking away something for yourself.
Now, if only everyone adhered to K&R indentation, I could read all the other people’s stuff so much more easily …
Schreibe einen Kommentar