The Whitespace Pattern

The other day I wrote down this Haiku out of disappointment:

With a necktie in January:
Erratic spacing at the end of lines
Heedless programmer continues to code

Disappointment that came from recently inspecting gallons of ruthlessly written source code. The business logic, coding standards, and refactoring aside; I was baffled foremost by the actual code formatting.

If I’m managing code that someone else wrote, I would expect to reach the end of a line when I click the ‘End’ key on my keyboard. What I don’t want is to land at position 542 of that line, with just whitespaces in between.

Don’t get me wrong, you need indentation and line-breaks to keep your code readable and easily maintainable, but you definetly don’t need excessive horizontal whitespace within or at the end of each line.

Excessive whitespaces at the end of several lines of code, just goes to show how unimportant that code is to the original writer, unless that code was written in an esoteric programming language like Whitespace!

In some ways, code is poetry. Ignorant programmers don’t understand that others may review and even maintain their “poetry”. If you don’t format your code, I would highly recommend (and request you) to start doing so by keeping your code clean, concise, and commented. Consider this advice as a ‘design pattern’ for respecting your own code.

2 thoughts on “The Whitespace Pattern”

  1. Everybody knows that whitespace at end of lines are hidden messages.
    Just replace tabs whith slashs and spaces with dots, then use a “Morse code to text” translator, and you will see hidden messages.
    Maybe hidden comments?
    Maybe coder’s gods messages?
    Maybe premonitions?

  2. Actually, trailing white-space only shows that the author used an editor which doesn’t remove that stuff automatically.

    So, my advice is: Check if there is an option for that stuff and if so, enable it. Trailing white-space is pointless and annoying.

Leave a Reply

Your email address will not be published. Required fields are marked *