Date Tags coding

Recently, I came across some horrible, horrible code. I immediately pasted it into a messaging application and quickly received an expression of solidarity. With what though? My indignation? Grief? Amusement? I find it suspicious that code I consider horrible tends to have been written by people I already disliked for some reason.

Here are some things I have complained about recently:

  1. Code that was the source of a bug that was in retrospect obvious.
  2. Code that could be deleted with no change to the behavior of the program other than, possibly, a performance improvement.
  3. Extremely inefficient code, perhaps extravagant in memory use or accidentally elevating the order of complexity.
  4. Extremely efficient code, in one tiny section of the program that made no measurable contribution to overall performance.
  5. Flow control making use of (a) if/else, (b) monadic combinators, or (c) pattern matching, in lieu of one of the other two.

Occupying their own special corner of my lizard brain are the following nomenclatural iniquities:

  1. Ambiguous or (gasp) misspelled names. I got very upset recently about a block of code that contained three nearly identically named variables, differing only in the placement of underscores.
  2. Comical adherence to coding standards. Well, comical to me anyway. I found val userUuid = UUID.randomUUID hilarious.
  3. Symbols that were literally the opposite of the true meaning, for example a list of excluded things called included.
  4. Symbols that had clearly been repurposed without being renamed, for example hostname containing a user count.

Here are some things that I often do before complaining about horrible code:

  1. Googling to make sure that the complaint is legitimate.
  2. Learning from such googling that the complaint is not legitimate and then observing my blood pressure fluctuate in an interplay of rising embarrassment and receding indignation.
  3. Recalling such painful personal experiences to illustrate my sense of fairness and stiffen my resolve.
  4. Recalling that time when I woke up in a cold sweat the night after noisily pointing out someone's mistake that turned out either not to be a mistake or to be my mistake and deciding not to send my artfully composed email after all.
  5. But not deleting it from Drafts either.
  6. Realizing that, while I know that the code in question is horrible, I don't understand precisely why, and so spending the rest of the afternoon reading about catamorphisms.
  7. Realizing and then suppressing the thought that I wrote code that was horrible in a very similar way, actually quite recently.

With reference to that last point:

An ignorant person is one who doesn't know what you have just found out.

- Will Rogers

Neurological reality:

  1. This code makes me nervous and raises my cortisol levels. I have OCD, for chrissake.
  2. But my genuine surprise is no less wounding than feigned surprise.

Miscellany:

  1. This mess makes it hard to do my job and may lead to outages!
  2. Seriously, what is the objective importance of either my job or your outages?
  3. It's so funny!

Existential crises after pondering a world where no code could be called horrible anymore:

  1. Could code in such a world ever meaningfully be called good - or wonderful? Would code not so designated be by implication horrible.
  2. But craftsmanship is an objective good, no?
  3. Why? Isn't craftsmanship basically about making nice things for rich people to display ostentatiously? Doesn't all morality come down to aesthetic preference anyway?
  4. Something that I find important is evidently not important to everyone. This makes me moderately sad.
  5. If two people disagree about what is horrible, can anything they say to each other be called communication?
  6. Glimpses of a chaotic hell. Heat death of the universe.


Comments

comments powered by Disqus