a companion discussion area for blog.codinghorror.com

Death to the Space Infidels!


#221

I’m a moron too xD. Tabbing has always been the way to go for me. I have never even considered using spaces, and my hand does it automatically.


#222

It seems to me that the difference between 2, 4 and 8 space tabbing is akin to asking experts and novices to memorize chess pieces on a black and white tiled board versus a red and green tiled board. I agree a team should have standards so you don’t get into a check-in format war at that trivial of a level but the study looks like it was more about memory relating to rationally ordered statements versus random randomly ordered statements. I just feel that comparing that to whitespace preference is a false analogy.

SoapboxIf you don’t use an intelligent IDE of some form then you don’t care about productivity…and notepad.exe is not an IDE./Soapbox


#223

Using tab characters does indeed allow others to see things according to their preferences, but it’s only a small step in the right direction. There are many more aspects of preference that need solving. The goal should be for editors to reformat the code to your preferences on load, and reformat the code to a standard format on save. (In the event that the editor can’t parse the code, it can simply skip the reformatting step.)

The interaction between automatic reformatting and manual alignment should be interesting – perhaps Nick Gravgaard’s elastic tabstops would provide a solution.


#224
  1. You can’t get by without spaces.
    Silly. You can’t get by without the letter A. That doesn’t mean you should use the letter A everywhere.

  2. a mixture of tabs and spaces will inevitably lead to misaligned, hard-to-read code.
    Silly. It’s misaligned because people indent with different numbers of spaces. If people didn’t use spaces, there would be no alignment issues!

  3. you can get by without tabs: in fact, everything they do is really much better done by other means.
    EXCEPT indentation because everybody wants to impose their own goofy number of spaces on other people!


#225

convert between different sized indent amounts (but you won’t find these functions anywhere)
Any this would mean spurious differences in source contro.


#226

Spaces are: absolute, predictable, necessary, reliable, standard, WYSIWYG.
Except, it’s 2, 3, 4, 5 spaces = not absolute, not necessary (for indentation), not predictable, and not reliable, and not standard!

Tabs are neither of the above.
Tabs are -one- thing.


#227

WYSIWYG is not an accurate description for spaces.

WYSIWTS (What You See Is What They See) is what is meant here. Then the question just becomes what on earth would possess you to want to force others to see things according to your formatting preferences instead of their own?


#228

Ah… the joys of whitespace. I’m currently doing my project for college on an AS400. Newer versions of RPG have whitespace but the version installed on the college machine doesn’t. In some ways it’s actually easier but then you’ve forgotten an endif somewhere and it takes about ten minutes to track it down in a nested if statement…

I personally feel that tabs are quicker. I can’t imagine hitting spacebar three times everytime I wish to indent. Just hit tab once and you’ve got your indent.

Doesn’t hitting spacebar all the time give you a headache?


#229

Hi.

I’m the guy that made the statements about a developer changing code of others (all others in the department).

RE:
This guy seems to be complaining about a lot less trivial changes than tabs, spaces and the location of curly brackets.

No - quite definately this is about trivial changes, locations of spaces, tabs as well as Variable and Function names. This is nothing about cleaning code, but entirely about reformatting. And that is what has me scratching my head.

I take no offence to this - my code is being altered to the way the person wants and they are a boss. I get paid a good wage and they can litterally do with my code whatever they like (sell it, delete it, alter it, etc.) I’m not so arrogant to get offended that my code is changed, after I write it. I’m proud of the work I have accomplished but then it then belongs to the company.

I just thought it very strange that this person would spend the time to do reformatting just for the sake of reformatting. Is it putting their stamp on the code? Is it them trying to understand the code? Is it just that they find it easier to read?

The greatest impact is on code revision checking, because things that look like changes to the code are merely changes in white space or function names. But again, I don’t relaly care too much about that.

But I’m just left puzzled as to why it even happens.


#230

There are decent editors who will unindent the proper amount when you hit backspace on a space-indented line.


#231

another moron, another tab lover :xD


#232

I’m a first year engineering student and recently had to complete my first major group programming project. One annoyance we ran into was different programs using different tab spaces. So code that looked perfectly tabbed in one editor was completely misaligned in another. So maybe spaces is a better solution. I personally do prefer tabs though since I’d rather hit backspace once rather than four times or hit tab once rather than the space bar four times.


#233

choosing spaces will increase your source code size if you’ve converted tab to spaces according to your editor setting the source code will be replaced with 4-8 tabs(whichever you specified). while tab can be represented with single character.

Anyway as you said it’s upon the policy of team, group or organization to stick with particular style.


#234

It should read: I’m a spammer and identity theif.


#235

Could you help me. You can have it all. You just can’t have it all at once.
I am from Jordan and learning to write in English, give true I wrote the following sentence: Airline carry on restrictions liquids.

Thank you so much for your future answers :p. Horus.


#236

The Tab button is short for Tabulate. Therefore it should be reserved for those situations where you would like to format your code into specific columns of indentation.

e.g. classes to the far left, one tab in for functions, another tab for initial code in those functions.

That was always the intention of Tab.

But the point everyone is missing is that Jeff wasn’t serious about the moron bit. We REALLY need a sarcastic font so intention is obvious.


#237

wow, it’s interesting to see that an article about blank characters generates about double the comments then one about the meaning of open source in job interviews :wink:

maybe it’s because you insulted our beloved TABs…

i, personally, like tabs because it prevents me from curser-arrowing myself to death when debugging nested structures. plus, with the stroke of one key, i’m exactly at the next code level, no mistake possible. also, when you space your code, different preferences can get VERY dangerous, especially, when one guy likes two, the other likes 4 spaces - with tabs, thats a simple config setting. plus, space indented code tends to get really messy after a few revisions when people are careless. so i see use of tabs vs. spaces a bit like OOP vs. procedural languages: a good developer can get the same results with both, but OOP helps to protect us from the slobs out there (and most snobbish programmers despise non-OOP langs using mainly that argument).

and on correcting others code: to rename other peoples vars or functions should be a definitive no-no (except when sombody uses varnames like a1-z99 - that person has simpy forfit the right to touch code)! but i must confess, when i have to debug very complex strange code, i simply must reformat white spaces (bracket positions and such) or i would have a serious loss of overview and efficiency.


#238

Somebody probably already said this above, but lots of modern code editors have an option to make the tab button add spaces to your code. It functions like the tab button, but it’s actually adding space characters. This is important if your code is going to be appearing in different editors. Everything reads space characters the same, but not tabs.


#239

Sorry for coming in so late, I was in another universe for awhile. However, to jump right in, I feel two spaces leads to not enough of an indent and four spaces uses to much room, so I prefer 3 spaces I know its an odd number but what the hay. Really it appears to be the perfect spacing for code indents. If you really can’t deal with the odd number, four spaces is definitely better than two as a good programming practice if you are indenting too much then you should be breaking that code up some.

BTW, for most of those tab-freaks your editor should have a keyboard shortcut to the beginning of a line or the first character in a line. In Unix/Emacs it is crtl-a once to beginning of line and twice to get to first char. In Windows it is the home key. IF other editors don’t have it and it’s open source add the functionality in.

Anyway the point is tabs are usually not the way to go in multiple environments / multiple developers. IMHO.

Last point to tab-freaks, I was a self-proclaimed TAB-FREAK for many, many, many years. Reviewing code from multiple environments / multiple developers will crush your desire to see a single tab in code ever again!!!


#240

Spaces always work. Tabs often don’t.