My code sucks.

Cha­sing a link via Twit­ter, I recent­ly read Your code sucks. Having gone over a lot of other people’s code mys­elf, and wri­ting code for long enough to have a good histo­ry of my own work to go over, it reso­na­ted with me. 

I recent­ly had the misp­lea­su­re of debug­ging a pie­ce of code that I wro­te almost ten years ago. It was, in many ways, pain­ful to read. Alt­hough I still use the same lan­guage as back then, things have way evol­ved: The lan­guage, for one. Deve­lo­p­ment tools. (Well, not mine: I still use Emacs.) But most of all: My know­ledge and my men­tal hori­zon in pro­gramming. I’ve loo­ked at various other things to enrich my skill set, brin­ging to my own coding habits tools that work well in other lan­guages. I also got to under­stand the tools I use bet­ter (espe­ci­al­ly data­ba­se tools – tho­se are so rich, and so few tools ever real­ly use them). So, with that expe­ri­ence in mind: My code does suck. But I much pre­fer some­thing that I wro­te ten years ago to be pain­ful to read, becau­se it means that I have lear­ned a lot. Even though I feel gre­at satis­fac­tion with the things I wri­te today, I am sure that in ano­ther ten years time, I will look back at todays work and feel a slight sen­sa­ti­on of being asha­med of what I did. 

And this hum­bles me in rea­ding other people’s code. It does not hurt to assu­me com­pe­ten­cy in others; they may have dif­fe­rent rou­tes they take in sol­ving pro­blems. But if one gets to think like they do, under­stand why they wro­te the code the way that they did, that cer­tain­ly may lead to your taking away some­thing for yourself. 

Now, if only ever­yo­ne adhe­red to K&R inden­ta­ti­on, I could read all the other people’s stuff so much more easily …


Beitrag veröffentlicht

in

von

Schlagwörter:

Kommentare

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert