|
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
|
|
|
|
|
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
|
|
|
|
|
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 .
Software Zen: delete this;
|
|
|
|
|
It'll be ok Gary... just think about fluffy kittens.
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;
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
Heard a nice one today: Explicitly Configured (hard-coded)
|
|
|
|
|
Almost as good as 'stringly typed' (when string is used as universal datatype for everything).
I need a perfect, to the point answer as I am not aware of this.
Please don't reply explaining what method overloading is
|
|
|
|
|
Clearly, we've both seen the same kinda databases before.
Jeremy Falcon
|
|
|
|
|
Not only databases. It gets really sick when something like this appears in the code:
(somecontrol.text = float.Parse(x) * float.Parse(y)).ToString();
x and y are strings, of course. Th use of float.parse() can fail any time when the strings can't be parsed, no checks or a try/catch block. The text property of the control of course also serves as stringly typed storage for the calclated value. And that's only the beginning of the horrors in that ASP.Net web form.
I need a perfect, to the point answer as I am not aware of this.
Please don't reply explaining what method overloading is
|
|
|
|
|
About the only logical explanation I can come up with is if they're using like a web service that only has strings for data. Outside of that...
Jeremy Falcon
|
|
|
|
|
Some people never really get what types are all about. This particular guy would have been insulted after such unwarranted criticism. He was one of those who could recite every rule and convention there may be and believes that everything is well as long as these rules are observed. Who needs to think when some guru already has done that and packaged his wisdom in rules and conventions?
I need a perfect, to the point answer as I am not aware of this.
Please don't reply explaining what method overloading is
|
|
|
|
|
Common sense ain't so common man.
Jeremy Falcon
|
|
|
|
|
I have seen that before. In some companies it's the standard procedure to reduce the code monkeys to better typists and keep them in line with rules and conventions. What do you think happens when you try to give one of those poor guys room to think for themselves?
I need a perfect, to the point answer as I am not aware of this.
Please don't reply explaining what method overloading is
|
|
|
|
|
CodeWraith wrote: What do you think happens when you try to give one of those poor guys room to think for themselves I have just heard the exact opposite - outsourced project to Hyderabad and the PM is bitching that the "developers" can't think for themselves and need to be spoon fed every decision.
She now knows the difference between a developer and a code monkey.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: She now knows the difference between a developer and a code monkey. Yup. In my view a code monkey knows one thing and one thing only... code. <robot_voice>Must... compute... X... Y... Z</robot_voice> And has very little understanding about people, teams, being a good leader or a good follower, how to play poker, anything at all really besides just code.
Jeremy Falcon
|
|
|
|
|
"To a boy with a hammer, the whole world looks like a nail".
|
|
|
|
|
|
Jeremy Falcon wrote: Common sense ain't so common man.
Heard it a different way:
Common sense ... the curse in disguise: Because if you have it, you're doomed to live with those that don't!
|
|
|
|
|
Reminds me of my MBA studies. Yes, business school is the study of common sense (in a capitalist society).
|
|
|
|
|
I think I've worked with that guy. Or maybe there's just a bunch of them
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|