Sunday, 25 October 2009

Style sheets for IDEs

As programmers, code layout is very important to us.

If code is presented in a way we are familiar with, we can skim-read entire passages of code in very little time and find our way to the significant details very quickly. With well presented code, you can often see the general flow of the code without even having to read the fine details.

Conversely, if the code we read is layed out poorly, it can be a real struggle to read through, and can take a very long time to get even a basic understanding of the code.

Unfortunately, "well presented" is a very personal, subjective description of code.

Indent with 3 spaces or 4? Tabs or spaces? Braces on the same line as other code? Alignment of variable names? Prefix? Hungarian?

There are hundreds more examples. If you surveyed every programmer you knew, I'm sure you wouldn't find any two who agreed on every point of code layout.

The trouble is, there is no right answer - there are valid reasons for all the choices.

What we need, is a way of separating out the code from its layout - syle from substance.

When we have IDEs which can present any piece of code in your style, we'll have made a great leap in the speed of code comprehension.