Code Layout Matters

From WikiContent

Revision as of 20:31, 22 November 2008 by Sf105 (Talk | contribs)
Jump to: navigation, search

An infeasible number of years ago I worked on a Cobol system where staff weren't allowed to change the indentation unless they already had a functional reason to change the code. Presumably, this was because someone once broke something by letting a line slip into the special columns at the beginning of the line. Unfortunately, this applied even if the layout was misleading, which it sometimes was, so we had to tread very carefully when reading the code because we couldn't trust it. The policy must have cost a fortune in programmer drag. This is a nice example of why code layout matters.

I spend much more of my programming time navigating and reading code than typing. The hard part is usually finding where to make the change, so I want to make scanning code as easy as possible. One optimisation is to try to make everything that isn't directly relevant to the domain, all the accidental complexity that comes with our workaday languages, fade into the background by standardising it. People are really good at visual pattern matching, it's a leftover from the time when we had to run away from lions, so

Working clean.

Personal tools