Tabs, Spaces, 2 column widths, 4 column widths, oh my...
-
harold aptroot wrote:
2.718
I prefer 2.6589754 spaces, but hey, now we are splitting hairs. :)
-
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
3 Empty spaces here
M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
-
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
-
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
One space is too short. Other than that, whatever the environment provides for a tab is fine. The point is to quickly see nesting, not to conform to the whims of some mad god.
"There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli
-
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
Three column tabs? Now that really is odd.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010
-
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
Jeremy Falcon wrote:
So, I'm curious to know, what do y'all use still and why?
Whether spaces or tabs, 2, 3, 4, or 5 (I loved 5 when I was doing C++ work years ago), I don't particularly care, as long as: 1. The IDE creates appropriate indentation when I hit the tab key 2. The IDE is smart enough to un-indent the entire group of spaces when I hit the delete key anywhere in the indented region (this is extremely rare, which is why I prefer tabs over spaces) 3. The IDE supports block indent \ un-indent 4. The IDE supports a "format" which will format the entire code block/file to however I've set up my IDE. 95% of the time I love how pressing '}' will reformat the C# / Javascript code. But what I really grouse about is vertical spacing. I am anal about that. Here are the rules not all dealing with vertical spacing: 1. C# using (and other language equivalents) should be in alphabetic order, unless, like in some other languages, they are imports that have dependencies on prior imports 2. .NET framework using's come first. 3. Third party using's are alphabetically grouped next, with a blank line between them and the .NET using's above. 4. Internal library using's next, grouped and separated as #2 5. Application specific using's next, same 6. One class per file 7. Methods separated by a single blank line 8. Public events first, one per line, the group "guarded" by a blank line. 8. Public properties next, one per line, the group "guarded" by a blank line. 9. Protected/private properties next, one per line, the group "guarded" by a blank line. 10. Internal fields next, one per line, the group "guarded" by a blank line. 11. Public constructors next, each constructor method separated by a single blank line. 12. Protected/private constructors next, each constructor method separated by a single blank line. 13. Public methods next, each constructor method separated by a single blank line. 14. Protected/private methods next, each constructor method separated by a single blank line. OK, I must be really bored at work to have just written all that down. :rolleyes: Marc
Latest Article - Create a Dockerized Python Fiddle Web App Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Ar
-
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
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt
-
harold aptroot wrote:
2.718
I prefer 2.6589754 spaces, but hey, now we are splitting hairs. :)
-
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: