I had a computer science professor in college who would subtract massive amounts of points for improperly formatted code. This led to heroic tabbing on my part, but I always felt slightly resentful about it. It’s code! It runs the same whether you indent it or not! Computers don’t care, and these are the same OCD snobs that reject otherwise perfect code for want of a “;” or perhaps a misplaced “)”.
I was impressed, however, when I ran across this presentation on beautifully formatted Ruby on SpeakerDeck.com . It was really so…beautiful. Even a curmudgeon like myself could appreciate the difference between this:
and this:
Rather than slowly try to figure out which piece belongs to which, and what on Earth :record_class is, we have a simple, easy to understand block, with all the relations listed hierarchically, teaching us a great deal about the structure of the code, and the site it supports, in one glance. I’ve studied a bit of design and gotten a good appreciation for the importance of things like text alignment and style on the front end of web pages, but have rarely thought about the importance of style on the back end. This provides a fresh perspective – code doesn’t just exist to communicate with computers. After all, the best way to communicate with computers would be a series of 0s and 1s. It’s designed to communicate with programmers, and the same visual design rules apply, even if the public never sees it.