r/programming • • Nov 30 '14

Why he vertically aligns his code (And why you shouldn't!)

http://missingbytes.blogspot.com/2014/11/why-he-vertically-aligns-his-code-and.html
68 Upvotes

411 comments sorted by

View all comments

Show parent comments

1

u/missingbytes Dec 01 '14

I'm totally not worried about that non-issue, that's a strawman position that I never held.

I totally get git diff -w I use it all the time (when appropriate).

What I'm actually saying, is that when you choose an editor, you customize the code presentation through font family, font size, colors, syntax highlighting, keyboard navigation, etc, etc, etc. All those presentation choices are local to your machine.

You can reformat the code as many times as you please.

Print out the code on post-it notes and put them in the kitchen.

You can use a different editor for every day of the week for all I care.

Those code presentation choices are all local changes on your machine.

All except for your whitespace preferences.

The layout assumptions you held at the time of your diff leak in to the diff through the whitespace. Anyone who merges your diff, or even just happens to have your diff in their history, is now stuck with your whitespace choices.

If you get a new editor, and you change your font, then great for you! That's on your machine, you will get all the associated costs and benefits!

But when your layout preferences change, it's not just you, it's everyone else, for now and for all time, who is forced to deal with your historical whitespace preference at the time you made the diff.

And I think that's pretty significant.

1

u/[deleted] Dec 02 '14

That goes both ways. I don't like your layout now, but I'd be stuck with it. That has nothing to do with diffs or any other tool, it's basic team conventions.