Tabs vs Spaces
-
What does using spaces have to do with collapsing code that you don't need to see right now?
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing.You should see this crazy code. It was like they decided arbitrarily each day where to start their nested content.
code
condition
{
code
condition
{
super long lines of code that go all the way off a standard screen with references to deeply nested arrays
}
other code
} -
You should see this crazy code. It was like they decided arbitrarily each day where to start their nested content.
code
condition
{
code
condition
{
super long lines of code that go all the way off a standard screen with references to deeply nested arrays
}
other code
} -
What does using spaces have to do with collapsing code that you don't need to see right now?
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing.Plus it's way easier to screw up the number of spaces needed. I guess that IDEs can be set to auto indent with spaces, but if someone else goes in there with notepad, it'll be a mess in a hurry. Using tabs discourages the use of notepad. Is that controlling? Maybe. I am a megalomaniac only in the coding, otherwise I'm very accommodating, so I'm comfortable with that.
-
You should see this crazy code. It was like they decided arbitrarily each day where to start their nested content.
code
condition
{
code
condition
{
super long lines of code that go all the way off a standard screen with references to deeply nested arrays
}
other code
}That's beyond sloppy. I would reformat it, and anyone who complained would be auditioning for a boys' choir.
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing. -
You should see this crazy code. It was like they decided arbitrarily each day where to start their nested content.
code
condition
{
code
condition
{
super long lines of code that go all the way off a standard screen with references to deeply nested arrays
}
other code
}I'm regularly asked by other coders to fix code or tweak code that is formattwed like this, or worse. U like my indents to be a consistant 1/4 inch so the long lines of code don't wrap because they have several levels of indent in them. Just give me Allsup (ANSI) format.
-
No, TAB stops are by distance, not character count. A half inch is sufficient.
You've got a point there. Word and WordPad (and many others, I'm sure) default to a proportional font so the default tab is 1/2 inch. Oddly, with a monospace fonts, I don't even consider the distance, per se, but instead a sufficient number of characters to make it read comfortably. Perhaps others do this? In any case, I normally choose 4 characters for the tab length in those files but I may have been influenced by so many editors choosing that same number.
-
Quick survey... How many of you uses tabs vs spaces to indent your code?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
Indent? That’s really a thing? I just left-align everything. Tried right-align, but that was messy. :)
Time is the differentiation of eternity devised by man to measure the passage of human events. - Manly P. Hall Mark Just another cog in the wheel
-
Quick survey... How many of you uses tabs vs spaces to indent your code?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
I use spaces (inserted using the Tab key) according to the language: Python - 4 as is the usual setting, HTML/JavaScript: 2 because otherwise indenting of HTML tends to become too high to be comfortable.
-
That's beyond sloppy. I would reformat it, and anyone who complained would be auditioning for a boys' choir.
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing. -
I think it had to do with what a mechanical typewriter was able to reliably insert. Remember, the tab key didn't shift x spaces, it shifted to the next tab stop, and yes, these were physical stops in a mechanical typewriter. Since these old machines worked on a fixed width font of 8 characters per inch and the physical tab stops were one inch apart, a tab became associated with 8 characters.
-
Beer cans used to have tabs...so I prefer tabs. :)
PartsBin an Electronics Part Organizer - A updated version available! JaxCoder.com
-
I fine with that as long as you pick up the tab!
"If we don't change direction, we'll end up where we're going"
Not any more Tab Soda 12 Pack Soft Drinks Tab Soda Discontinued 🥤02/2021 | eBay[^]
PartsBin an Electronics Part Organizer - A updated version available! JaxCoder.com
-
Quick survey... How many of you uses tabs vs spaces to indent your code?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
Beer cans used to have tabs...so I prefer tabs. :)
PartsBin an Electronics Part Organizer - A updated version available! JaxCoder.com
-
Competition for your "PartsBin" Wait... What? I Made a Small Parts Organizer with Drawers from Cardboard! - YouTube[^] Perhaps include this as an add on
Awesome thanks for the link. Good storage alternative, especially since the organizers are so dang expensive.
PartsBin an Electronics Part Organizer - A updated version available! JaxCoder.com
-
Quick survey... How many of you uses tabs vs spaces to indent your code?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
I use Tabs for Columns, and spaces for strings, Carriage Return/Line Feed for new Row. Makes sense when Using Excel. For notepad it doesn't matter :-)
-
Quick survey... How many of you uses tabs vs spaces to indent your code?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
If(spaceToAdd > 1) { Tab(); } else { Space(); } // This is how my brain does it :P
-
Quick survey... How many of you uses tabs vs spaces to indent your code?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
Quick survey... How many of you uses tabs vs spaces to indent your code?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
I use tab and shift+tab in VS to keep things in neat code blocks. I don't really care how many spaces a tab is as long as it's consistent (I use the default). I've never seen a good reason to use spaces, whenever I see code like that it's usually a mess. It's possible to format code well using spaces, but that's not what I usually see in the wild.
-
Quick survey... How many of you uses tabs vs spaces to indent your code?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
If it doesn't auto-indent, I will tab. But now I wonder if K&R C had anything to say about that :~