The One True Style of indentation
by Wil, Mon, 2002-04-22 10:30
One space
0% (0 votes)
Two spaces
7% (1 vote)
Three spaces
0% (0 votes)
Four spaces
27% (4 votes)
Six spaces
0% (0 votes)
Eight spaces
0% (0 votes)
Tabs
67% (10 votes)
However I feel today
0% (0 votes)
Random
0% (0 votes)
All on one mighty big line
0% (0 votes)
Total votes: 15
- wil
necrotic posted this at 02:53 — 4th May 2002.
He has: 296 posts
Joined: May 2002
Oh wow! I love being the only one who does 2 spaces... It's just easier to do 2 spaces than 4 or a tab. And I use Notepad, so the tab is WAY to big. But I also double-enter blocks of code. Which makes it way easier to read.
[James Logsdon]
Mark Hensler posted this at 04:35 — 24th April 2002.
He has: 4,048 posts
Joined: Aug 2000
I hate the way notepad has a tab width of 8 columns. Code with a lot of nested items can get pushed pretty far to the right.
Suzanne posted this at 20:30 — 23rd April 2002.
She has: 5,507 posts
Joined: Feb 2000
I learned how to write rudimentary perl first, then JavaScript, and now I'm playing with PHP. Somewhere along the line I read that article and also the articles about where braces should go (in different languages) and I'm hopelessly addicted to using spaces instead of tabs (which is why I have the program set to replace tabs with spaces) -- if you go into another editor where the tab is set differently, you have a devil of a time with the code.
Mark Hensler posted this at 18:33 — 23rd April 2002.
He has: 4,048 posts
Joined: Aug 2000
very good doc
Wil posted this at 08:28 — 23rd April 2002.
They have: 601 posts
Joined: Nov 2001
LOL!
I personally use 4 spaces (well my editors sets this when I 'tab' anyhow) - because I code in Perl most often, I think this is 'right' => http://www.perldoc.com/perl5.6/pod/perlstyle.html .
I think the style and clarity of your code is amazingly important - so is proper annotation and comments. I've been in a situation before where you take over from someone's else's code, and if it's messy code it makes your job a hundred times harder!
Cheers
- wil
openmind posted this at 22:04 — 22nd April 2002.
He has: 945 posts
Joined: Aug 2001
Gotta be one tab at a time 4 me. Only way I can keep track on what the hell I'm doing!
Plus its doesn't half help when you're trying to track down those pesky closing tags!
Mark Hensler posted this at 22:01 — 22nd April 2002.
He has: 4,048 posts
Joined: Aug 2000
Oh, BTW... PHP's PEAR Coding Standards states, "Use an indent of 4 spaces, with no tabs."
Mark Hensler posted this at 21:58 — 22nd April 2002.
He has: 4,048 posts
Joined: Aug 2000
This isn't fair!! :whine:
UNIX shell = 2 spaces
PHP, Perl = 4 spaces
VB = tabs
I also have my ASCII editor set to convert tabs to spaces. But I use M$ Visual Studio for VB, and I don't think they're advanced enough to include such a feature.
I voted 4 spaces because I use PHP the most.
Mark Hensler
If there is no answer on Google, then there is no question.
mjames posted this at 19:34 — 22nd April 2002.
They have: 2,064 posts
Joined: Dec 1999
Tabs for me. I also love tidy code - that's why I use an ancient editor to format my code (AOLpress).
Suzanne posted this at 19:02 — 22nd April 2002.
She has: 5,507 posts
Joined: Feb 2000
I have my editor set to replace tabs with spaces, and the tab is set to 4. Can I answer both?
I love tidy code. Not only easier to troubleshoot, but easier to simplify. I tend to write it all out in long code as I'm building something, then gradually boil it down like a good spaghetti sauce to the right bits, automating and building functions and such as I go.
Having tidy code and comments REALLY helps that process.
Peter J. Boettcher posted this at 14:03 — 22nd April 2002.
They have: 812 posts
Joined: Feb 2000
It is so much easier debugging clean code than messy, plus its a reflection on the type of person you are!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.