If you can read this, either the style sheet didn't load or you have an older browser that doesn't support style sheets. Try clearing your browser cache and refreshing the page.

(IT World)   The optimal coding indentation style? Easy. Tabs that are 84% soft and 3.3 columns wide   (itworld.com) divider line 59
    More: Obvious, line coding, 1TBS  
•       •       •

2069 clicks; posted to Geek » on 06 Mar 2013 at 9:43 AM (1 year ago)   |  Favorite    |   share:  Share on Twitter share via Email Share on Facebook   more»



59 Comments   (+0 »)
   
View Voting Results: Smartest and Funniest

Archived thread

First | « | 1 | 2 | » | Last | Show all
 
2013-03-06 07:34:15 PM
1. 3 spaces, because it's the same length as "if ".
2. No tabs, because tabs fark up vertical alignment, and cause major spacing headaches
3. Compact control readability style, because well, that's what you should be using
4. Allow for vertical alignment because you can really find mistakes this way

/anal about readability
//90% of my code ends up with zero syntax issues
///the other 10% is usually missing semi-colons
 
2013-03-06 09:40:25 PM
COBOL - 2 spaces
ABAP - 2 spaces

no tabs, it confuses some editors
 
2013-03-06 09:57:02 PM
Company/organization writes a spec on paper.
All members of above conform to spec.

Beginning, middle, and end of story.

/I don't care if you all agree to use cute kitten icons to tab out your code; say what you do and do what you say. Also try to plan for the ability to convert to another spec en mass with some regular expressions. Life is unpredictable.
 
2013-03-06 10:07:25 PM

RexTalionis: I prefer to write my code in a gigantic single line. Screw you, readability! As long as it compiles, it's good!


Ah, a Perl programmer.
 
2013-03-06 10:10:19 PM
Legacy FORTRAN 77 (or earlier) fixed-format file?

No tabs, hard or soft.

Ever.

I declare jihad on anyone who does.
 
2013-03-06 11:57:18 PM
meat0918:

m_bIsItADuck

Hungarian notation and underscores get no end of scorn where I am now. I'd get slapped around for using m_anything unless I was using sql.
 
2013-03-08 09:44:07 AM

blue_2501: 1. 3 spaces, because it's the same length as "if ".
2. No tabs, because tabs fark up vertical alignment, and cause major spacing headaches
3. Compact control readability style, because well, that's what you should be using
4. Allow for vertical alignment because you can really find mistakes this way


1. That's a stupid reason
2. Use tabs at the beginning of line for indentation. What other veritcal alignment are you talking about? After the beginning of the line? Like, trying to line up = signs? Of course you use spaces for that, if that kind of alignment is important.

If you came here and started shoving your damned "3 space" intdentation into my code and said it was because "'if ' is 3 characters" I would beat you with a stick.

Yes it's that kind of morning.

SoundOfOneHandWanking: no tabs, it confuses some editors


No it doesn't. It doesn't confuse vim and vim is farking 20 years old, and was born of vi which is older than that. If you're using an editor that's confused by tabs, then you're not using a code editor. You're using Microsoft Word to write code. Again with the stick and the beating.
 
2013-03-08 09:51:48 AM

Abner Doon: Hard tabs mean that the code looks like ass if I use a different tab-stop than anyone else, so you end up having to standardize on that instead of the number of spaces.  Totally useless solution.


.... what?

It doesn't fark up anything for anyone else.

Abner Doon: This comes up when you do things like break argument lists onto separate lines (for grouping by meaning or because the line would be too long, etc.) or in chained function calls, etc.


No it doesn't. Use tabs for indentation.

If you mean that you're trying to indent the function arguments, and then add another space so that the arguments line up after the first parenthesis '(' then, do that. Use tab to indent, and then add a space for that extra character alignment. At that point, you're not indenting, you are lining up specific characters, which is a totally different thing.

// lets say [tab] is a tab and | is a space
if(abner)
{
[tab]while(notRetarded) {
[tab][tab]callFunction
[tab][tab](
[tab][tab]|arg1,
[tab][tab]|arg2
[tab][tab])
[tab]}
}

See? not hard. Doesn't fark up anything for anyone. and everyone still gets their own tab stop width and everything is still character-aligned where it's supposed to be.
 
2013-03-08 09:54:29 AM
Another example

// lets say [tab] is a tab and | is a space

if(abner)
{
[tab]while(notRetarded) {
[tab][tab]callFunction(arg1, arg2, arg3, arg4, // oops, line getting long
[tab][tab]|||||||||||||arg5, arg6, arg7, arg8);
[tab]}
}

See? Tabs for indentation, spaces for alignment. Two separate concepts.
 
Displayed 9 of 59 comments

First | « | 1 | 2 | » | Last | Show all

View Voting Results: Smartest and Funniest


This thread is closed to new comments.

Continue Farking
Submit a Link »






Report