|
The perfect width for a tab or spaces is... 42
I use 4, always have, always will. If any of my devs use more or less or convert to spaces they are publicly humiliated and forced to wear mittens to code for the next week until they learn that 4 is THE magic number when it comes to tabs and tabs are as close to perfection as code spacing and indents can possibly get.
|
|
|
|
|
Come on man... give spaces a try. Peddling this like a drug dealer. Only the first space is free.
Not to open up that can of worms, but I was a hardcore tabs guy for years. But spaces are universal. Once I got used to spaces, I could see my code formatted well in any IDE. I could upload it to the web server, output or inspect it in the terminal on Unix/Linux or command line or Notepad in Winders and it still was formatted well. Basically, it made life more portable. I never went back.
Jeremy Falcon
|
|
|
|
|
Chuck Norris uses Tabs. So should you.
|
|
|
|
|
Oooooooh snap.
Jeremy Falcon
|
|
|
|
|
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.
|
|
|
|
|
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.
|
|
|
|
|
|
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
|
|
|
|
|
Been through the same journey as you. I like best 3 columns, but my current work requires 4 columns. Ah well.
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
You're a smart man!
Jeremy Falcon
|
|
|
|
|
Jeremy Falcon wrote: And clearly, everyone who doesn't agree with us is intellectually inferior by substantial margins.
And unworthy of my answer, so go away! Oh, wait, I've been ahead of you[^] for quite some time in this respect.
It Is The Absolute Verifiable Truth & Proven Fact
That Your Belly-Button Signature Ties
To Viviparous Mama.
|
|
|
|
|
2 columns and use tabs all applications, including TSQL.
ctrl e d will reformat the current file in c#.
Red-Gate has an excellent formatter for stored procs.
As the lead developer I set the standards and if I find someone has reformatted my code I get quite grumpy.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: As the lead developer I set the standards and if I find someone has reformatted my code I get quite grumpy That's the biggest thing... everyone being on the same page. I'll never get you two column folks. But I do think the project will suffer if the team can't agree on one.
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.
|
|
|
|
|
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.
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.
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
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
|
|
|
|
|
Always used 3 spaces for punch cards. Reasonable compromise for easy resorting when the deck was dropped v maximising levels of indentation given that the width of a card was 80 cols, and the last 8 of then were for sequence numbers. (Also useful for old versions of FORTRAN where statements started in col 7 - 2 * 3 spaces).
Now we have screens, I use TAB (only 1 key stroke) and accept whatever the editor of the day displays it at. I still try to limit lines to 80 chars.
|
|
|
|
|
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.
|
|
|
|
|
I prefer the length of two dried elephant ear hairs plucked by 24 year virgin males, and must be the 2nd child.
|
|
|
|
|
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
|
|
|
|
|
Three column tabs? Now that really is odd.
Ravings en masse^ |
---|
"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 |
|
|
|
|
|
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:
- The IDE creates appropriate indentation when I hit the tab key
- 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)
- The IDE supports block indent \ un-indent
- 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:
- 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
- .NET framework using's come first.
- Third party using's are alphabetically grouped next, with a blank line between them and the .NET using's above.
- Internal library using's next, grouped and separated as #2
- Application specific using's next, same
- One class per file
- Methods separated by a single blank line
- Public events first, one per line, the group "guarded" by a blank line.
- Public properties next, one per line, the group "guarded" by a blank line.
- Protected/private properties next, one per line, the group "guarded" by a blank line.
- Internal fields next, one per line, the group "guarded" by a blank line.
- Public constructors next, each constructor method separated by a single blank line.
- Protected/private constructors next, each constructor method separated by a single blank line.
- Public methods next, each constructor method separated by a single blank line.
- 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.
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
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|