Why he vertically aligns his code (And why you shouldn't)
missingbytes.blogspot.com
missingbytes.blogspot.com
I have noticed that, if you make code readable without syntax highlighting, it's always readable with syntax highlighting. The reverse is not true. I would even argue that the code readable without highlighting is more readable with highlighting than the code written just for highlighting.
I don't use vertical alignment. I do think that a long list of vars is harder to read and vertical alignment helps with that. Yet, the solution for me is to attack the core problem. I reduce the number of moving parts inside a procedure, which you can be sure variables are.
Perhaps the author should improve the trivial examples by showing the code with syntax highlighting and vertical alignment.
If you want vertical alignment, it seems easier to just align it vertically for yourself. Customize your presentation, but leave it generic for everyone else.
The reality is, there is a big difference between pretty code and readable code - when actually reading code, we do it line-by-line to discern meaning. Vertical alignment means we see these numbers as a collection, making them easy to read as a group, but that's not useful. What we care about is how those numbers link to the variables on the left.
Sure, the fact that syntax highlighting solves the same problem better is a good argument, but a better one is that vertically aligning assignments actually makes your code harder to read.
In addition to this, modern typography has different rules for different mediums. Bringhurst's typographic styles weren't meant to be applied to C# code nor should they be. We don't read code the same way we read books or magazines, thus it doesn't need the same treatment.
If we are going to start applying modern typographic elements to code that we write, then we need to start thinking about incorporating various font faces, weights, worry about the kerning and leading, add some headers and a host of other things.
+ int barney,
But the patch looks like: extern int SomeDemoCode(int fred,
+ int barney,
int wilma);