Whitespace: The Silent Killer

Oh, this is definitely my favorite blend of OCD. Fits snuggly right next to lining up opening and closing brackets to suite your particular tastes. Nothing is quite as satisfying as knowing that everything you don’t see is in order. Until you do something with it that is… Which is why you’d better make the invisible bits visible.

A very good idea for a post! You could’ve gone on longer though…

Wow, you people are all crazy :slight_smile:

Why haven’t you started putting those ) chars hard up against the preceding (following) elements? All those newlines and spaces in front of (after) them are also getting sent to clients, you know. As an added benefit, doing this as part of your coding standard would fix the strange-space-between-my-images issue that crops up from time to time. Doing this doesn’t have to make your code unreadable dross.

Using your example, the code would change to:
" class=“comment”>

Now any extra trailing whitespace on most lines here is server side only (the closing table tag could leak spaces to the client), and your bandwidth consumption will drop by a tiny fraction more.

I’m a programmer, and I don’t give a damn about terminal whitespace.

I only care about indentation because it improves comprehensibility.

(And seriously, what PRMan said. ASP syntax? You have far bigger problems than terminal whitespace.

But I completely disagree with the idea that smaller teams don’t need merging… at least unless you’ve broken all your code into a few thousand 50-line modules. Which is its own unique and pointless hell.)

This has to be a joke. Almost immediately after a post where you were deluged with complaints about how absurd the markup requirement to put whitespace at the end of lines to get line breaks, you make a post complaining about whitespace at the end of lines?

Then seeing all the OCD people complaining about whitespace who also support something as “unclean” as indenting with spaces is just…strange.

Trailing spaces do not matter really. I, personally, think that programmer should suppress all this control freakness in himself. It is a step to become professional. If you can’t make a difference between important and non-important, you can’t make anything real, it will always force you to rewrite infinitely to make code “perfect”. But the real code is the one which released and works, it does not need to be perfect. The cost of perfectionism is too high.

I pad all my code to the 80th column with spaces. Cheaper than medication.

In vim you can get rid of any trailing whitespace by adding the following to your ~/.vimrc

autocmd BufWritePre * :%s/\s+$//e

The problem with trailing white space is that it can ruin the formatting of the code when you’re adding/deleting parts of it. Bad formatting can RUIN readability and absolutely grate on the nerves of people with OCD. Fixing bad formatting takes precious time and developmental resources.

The problem with trailing white space is that it can ruin the formatting of the code when you’re adding/deleting parts of it. Bad formatting can RUIN readability and absolutely grate on the nerves of people with OCD. Fixing bad formatting takes precious time and developmental resources.

The problem with trailing white space is that it can ruin the formatting of the code when you’re adding/deleting parts of it. Bad formatting can RUIN readability and absolutely grate on the nerves of people with OCD. Fixing bad formatting takes precious time and developmental resources.

The problem with trailing white space is that it can ruin the formatting of the code when you’re adding/deleting parts of it. Bad formatting can RUIN readability and absolutely grate on the nerves of people with OCD. Fixing bad formatting takes precious time and developmental resources.

“We got into this industry because, quite frankly, we are control freaks. It’s who we are. It’s what we do.”

lol. Yes, that’s who we are!

The problem with “strip spaces on save” is that it only works it everyone on the team is using it and since the beginning of the project.

If you have an existing codebase with trailing spaces and turn this setting on, you’ll have tons of spurious, unrelated “diffs” even for a one-line fix.

I didn’t see the problem with the code, mostly because I was expecting something that would actually cause an error. When you finally started talking about trailing whitespace though, my brain caught up and yea… that pisses me off to.

The real problem is Visual Studio creating it seemingly at random every time you turn around.

Actually, it wouldn’t bother me if it didn’t screw up keyboard navigation. End should take me to the end of the text, not to the end of crappy unnecessary trailing whitespace!

Don’t care… extra white space is ignored, I’m sure it doesn’t end up in your compiled code and that’s all that matters.

Why not diff -bB, that seems to ignore most whitespace differences.

whitespace at end of line doesn’t bother me that much, but if the code contains tab indented lines, and space indented lines, then I go mad! It’s not that I prefer one over the other; in some projects I use one tab, in others I use two spaces.

This is the spergin’ist topic I have ever seen on this site, and thats saying a lot.

Whitespace schmitespace! I went like “OH MY FREAKIN GOD” ( y Jesucristo, Madre Maria y Todos Santos) when I saw pre-dot-net style old asp with the VB code and the markup together and no separate code-behind file. Eeew! How “Artist-Formerly-Known-As-Prince”, as in “Tonight we’re gonna web-code like it’s 1999!”

So, um, Jeff, are you like trying out for US Shark Jumping team for the 2010 Winter Olympics in Vancouver?