Tabs, Spaces, 2 column widths, 4 column widths, oh my...
-
Chuck Norris is NOT celebrated for his programming abilities.
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill
Meh! Chick Norris thinks in binary and writes in assembler. Everything he does is code.
-
Now you know, we as nerds just love a good debate. And clearly, everyone who doesn't agree with us is intellectually inferior by substantial margins. And no other topic, save a few, has this proven to more evident than in the tabs versus spaces great debate of our generation. Now, rather than fan the flame of that saga, I'm curious to know what people still prefer for tab width (regardless of an actual tab char or if it's spaces). For years, I've always been a four column guy with tab widths. I mean years. Anything else was stupid and bunches together what would otherwise be beautiful code. But then I started doing a lot of JavaScript development where the popular thing is to use two column widths. Ruby seems to embrace that too. It's ugly I thought. I shan't cave in. It's immoral and just wrong. But in being a team player you go along with what must be done for the sake of the project. Now, a couple years later. I look at four column tab width code and think "well gee that's just too damn wide." I still don't like two column width. Looks like the code is still in kiddy land when I see that. I started doing some plug-in development for a Forex trading platform a few years back. It's a proprietary language and by default it uses 3 column widths in the code editor for it. At first I was like "ok wtf." But after years of using that proprietary language... turns out 3 column width is perfect! You can use it everywhere. C#, C/C++, JavaScript. Whatever, it's a nice compromise for everyone. In this day and age where we are expected to learn 20 million things, both client and server, rather than just one language, I tend to find myself using this more and more so I don't have to readjust my eyes to differently spaced code all day long. Only problem is... nobody else uses 3 column widths that I know of. So, I'm curious to know, what do y'all use still and why?
Jeremy Falcon
4, with Visual Studio set to insert spaces. VS has been broken since VC6 when it comes to block indent/undent when you use a mix of tabs and spaces at the beginning of a line. If VS is set to insert tabs, on a block operation they convert leading spaces to tabs, and screw up the alignment :mad:.
Software Zen:
delete this;
-
Now you know, we as nerds just love a good debate. And clearly, everyone who doesn't agree with us is intellectually inferior by substantial margins. And no other topic, save a few, has this proven to more evident than in the tabs versus spaces great debate of our generation. Now, rather than fan the flame of that saga, I'm curious to know what people still prefer for tab width (regardless of an actual tab char or if it's spaces). For years, I've always been a four column guy with tab widths. I mean years. Anything else was stupid and bunches together what would otherwise be beautiful code. But then I started doing a lot of JavaScript development where the popular thing is to use two column widths. Ruby seems to embrace that too. It's ugly I thought. I shan't cave in. It's immoral and just wrong. But in being a team player you go along with what must be done for the sake of the project. Now, a couple years later. I look at four column tab width code and think "well gee that's just too damn wide." I still don't like two column width. Looks like the code is still in kiddy land when I see that. I started doing some plug-in development for a Forex trading platform a few years back. It's a proprietary language and by default it uses 3 column widths in the code editor for it. At first I was like "ok wtf." But after years of using that proprietary language... turns out 3 column width is perfect! You can use it everywhere. C#, C/C++, JavaScript. Whatever, it's a nice compromise for everyone. In this day and age where we are expected to learn 20 million things, both client and server, rather than just one language, I tend to find myself using this more and more so I don't have to readjust my eyes to differently spaced code all day long. Only problem is... nobody else uses 3 column widths that I know of. So, I'm curious to know, what do y'all use still and why?
Jeremy Falcon
But then again... Here's how I indent DCL (Digital Command Language) on OpenVMS. The VT100 emulator I use doesn't allow control over the TAB stops, so it's always eight columns and that's far too many. So I use one TAB after the leading dollar sign ($) to make a nice margin so my comments and labels stand out. Then it's a one-SPACE indent for THEN, ELSE, and ENDIF and a two-SPACE indent for statements inside those. A snippet from my DCL implementation of a Turing Machine:
$! Run the Machine
$
$ offset = 0
$loop2:
$ input = f$extract(offset,1,p2)
$ if f$type(TM_'state'_'input') .eqs. "" then goto eoloop2
$
$ output = f$element(2,",",TM_'state'_'input')
$ move = f$element(3,",",TM_'state'_'input')
$ state = f$element(4,",",TM_'state'_'input')
$
$ p2['offset',1] := 'output'
$
$ if move .eqs. "-"
$ then
$ if offset .eq. 0
$ then p2 = "_" + p2
$ else offset = offset - 1
$ endif
$ else
$ offset = offset + 1
$ if offset .eq. f$length(p2) then p2 = p2 + "_"
$ endif
$
$ goto loop2
$eoloop2:
$
$ write sys$output p2
$
$ goto end:cool:
-
4, with Visual Studio set to insert spaces. VS has been broken since VC6 when it comes to block indent/undent when you use a mix of tabs and spaces at the beginning of a line. If VS is set to insert tabs, on a block operation they convert leading spaces to tabs, and screw up the alignment :mad:.
Software Zen:
delete this;
It'll be ok Gary... just think about fluffy kittens. :laugh:
Jeremy Falcon
-
I've used so many differing styles (usually mandated by anal-retentive bosses) that today I just go with whatever (a) the company requires, or (b) the IDE inserts as a default. The only problem with using tabs as a formatting mechanism is when reading code in a different editor, whose tab setting differs. Your nicely (and carefully) formatted code then looks like a formatting disaster. :sigh:
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill
Daniel Pfeffer wrote:
usually mandated by anal-retentive bosses
:laugh: Amen to that brother.
Daniel Pfeffer wrote:
The only problem with using tabs as a formatting mechanism is when reading code in a different editor, whose tab setting differs. Your nicely (and carefully) formatted code then looks like a formatting disaster.
That's the same exact reason I swapped to spaces. Especially in web development where you just know your code will be different machines that don't always have VS installed, etc.
Jeremy Falcon
-
Now with wide displays is not as important, but 2 spaces (using tab) is good as it is not very space consuming but at the same time is clear enough to see the desired effect. And of course this doesn't allow any debate. I'm right. Anyone thinking a different thing must be burnt in fire. :rolleyes:
www.robotecnik.com[^] - robots, CNC and PLC programming
Joan M wrote:
And of course this doesn't allow any debate. I'm right. Anyone thinking a different thing must be burnt in fire.
That's a good point Joan. I'm not sure why I didn't think of that before. :doh: :-D
Jeremy Falcon
-
It'll be ok Gary... just think about fluffy kittens. :laugh:
Jeremy Falcon
My fluffy kitten (ok, she's 15 years old and surly) could do a better job than MS on this.
Software Zen:
delete this;
-
Now you know, we as nerds just love a good debate. And clearly, everyone who doesn't agree with us is intellectually inferior by substantial margins. And no other topic, save a few, has this proven to more evident than in the tabs versus spaces great debate of our generation. Now, rather than fan the flame of that saga, I'm curious to know what people still prefer for tab width (regardless of an actual tab char or if it's spaces). For years, I've always been a four column guy with tab widths. I mean years. Anything else was stupid and bunches together what would otherwise be beautiful code. But then I started doing a lot of JavaScript development where the popular thing is to use two column widths. Ruby seems to embrace that too. It's ugly I thought. I shan't cave in. It's immoral and just wrong. But in being a team player you go along with what must be done for the sake of the project. Now, a couple years later. I look at four column tab width code and think "well gee that's just too damn wide." I still don't like two column width. Looks like the code is still in kiddy land when I see that. I started doing some plug-in development for a Forex trading platform a few years back. It's a proprietary language and by default it uses 3 column widths in the code editor for it. At first I was like "ok wtf." But after years of using that proprietary language... turns out 3 column width is perfect! You can use it everywhere. C#, C/C++, JavaScript. Whatever, it's a nice compromise for everyone. In this day and age where we are expected to learn 20 million things, both client and server, rather than just one language, I tend to find myself using this more and more so I don't have to readjust my eyes to differently spaced code all day long. Only problem is... nobody else uses 3 column widths that I know of. So, I'm curious to know, what do y'all use still and why?
Jeremy Falcon
I also use 3 columns, and have done forever (well, since I first programmed in Ada in the 90s!) The company I work for still has a standard of 3 columns for indentation...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
I go along with whatever the IDE inserts for me when I hit TAB. What I hate is when VS separates the start (<) and end (>) of generic parameters onto separate lines. I don't have a problem with method call chains or method parameters spanning multiple lines, but those generic parameters belong onto the same darn line!
I only have a signature in order to let @DalekDave follow my posts.
Marco Bertschi (SFC) wrote:
I go along with whatever the IDE inserts for me when I hit TAB.
I do the same thing, mostly to be consistent with my team. But...
if(i.haveUltimateSaySo) {
i.useTwoSpacesInsteadOfTabs();
i.putCurlyBraceAtEndOfIfLine();
i.useCurlyBracesOnEveryLoopOrConditional();
i.useCamelCase();
}On the other hand, you have different fingers. - Steven Wright
-
Meh! Chick Norris thinks in binary and writes in assembler. Everything he does is code.
-
Quote:
Chick Norris
Is that Chuck Norris's sister?
- I would love to change the world, but they won’t give me the source code.
:laugh: :laugh: :laugh: