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.

Show Comments