• Why the hate on tabs?
    50 replies, posted
some coding styleguides i've come across state very clearly that tabs aren't allowed. as someone who uses tabs all the time, i'm honestly having a hard time understanding from their perspective why tabs are bad. to me, it really just seems like it's as simple as choosing whether or not you like tabs or spaces. is there some kind of deep-rooted problem with using tabs that i should be made aware of? is it just for style consistency? or just strong personal preference?
People will make arguments about tabs vs spaces for all of time, but in the end it really doesn't matter very much. Pro tab arguments tend to be that you might as well allow people to vary their indentation level on their IDE by varying tab display width, whereas pro space tends to go might as well enforce a consistent guideline everywhere, particularly because some formatting has to be done by spaces as you can't have half a tab Projects will pick and enforce one style just for consistency, and while I'm sure some people have a very strong personal preference, it doesn't really matter all that much
[QUOTE=Icedshot;51682831]People will make arguments about tabs vs spaces for all of time, but in the end it really doesn't matter very much. Pro tab arguments tend to be that you might as well allow people to vary their indentation level on their IDE by varying tab display width, whereas pro space tends to go might as well enforce a consistent guideline everywhere, particularly because some formatting has to be done by spaces as you can't have half a tab Projects will pick and enforce one style just for consistency, and while I'm sure some people have a very strong personal preference, it doesn't really matter all that much[/QUOTE] alright that sounds good. i've been looking at general style guidelines recently and the one from MDN for example just straight up tells me not to use tabs. i was like shit, i have a lot of editing to do [QUOTE=WTF Nuke;51682841]The biggest argument for spaces in my eyes is being able to space out arguments nicely: [cpp]call_this_function(with, these, args);[/cpp] I am thinking of switching over to spaces because of this. They give you a bit more control. But they also take away control from the person deciding how wide a tab is (because you can't decide how wide a space is).[/QUOTE] in these kinds of situations i tend put the first argument on a new line for the sake of alignment, but otherwise i see what you mean. to me being able to control tab width is very high up in my priorities for some reason.
The biggest argument for spaces in my eyes is being able to space out arguments nicely: [cpp]call_this_function(with, these, args);[/cpp] I am thinking of switching over to spaces because of this. They give you a bit more control. But they also take away control from the person deciding how wide a tab is (because you can't decide how wide a space is). [editline]17th January 2017[/editline] Also github fucks your shit up if you don't expect 8 space tabs (which to be honest, who even uses 8 space tabs?)
[QUOTE=WTF Nuke;51682841]The biggest argument for spaces in my eyes is being able to space out arguments nicely: [cpp]call_this_function(with, these, args);[/cpp] I am thinking of switching over to spaces because of this. They give you a bit more control. But they also take away control from the person deciding how wide a tab is (because you can't decide how wide a space is). [editline]17th January 2017[/editline] Also github fucks your shit up if you don't expect 8 space tabs (which to be honest, who even uses 8 space tabs?)[/QUOTE] GNU uses 8 space tabs for some reason.
Tabs are more convenient and I like my code indented 4 spaces anyway It doesn't make my code harder to read but it makes it more convenient to write I see no pros to mashing the spacebar a bunch of times just to make things look all special and even then I don't find it significantly easier to read that way If you're using a whitespace-agnostic language than there is no reason not to write the way you prefer as longas you're consistant
[QUOTE=TeamEnternode;51683063]Tabs are more convenient and I like my code indented 4 spaces anyway It doesn't make my code harder to read but it makes it more convenient to write I see no pros to mashing the spacebar a bunch of times just to make things look all special and even then I don't find it significantly easier to read that way If you're using a whitespace-agnostic language than there is no reason not to write the way you prefer as longas you're consistant[/QUOTE] Pretty much every text editor that's not notepad supports tab inserting spaces.
I tend to use tabs for expediency sake, but use several tabs followed by n spaces under cases like WTF nuke pointed out
Is there a case where we use tabs in one editor, and when we transfer the code to a different editor, the spacing got haywire or something?
Any editor worth its salt lets you specify the width of a tab so yes initially it's possible until you adjust your tab settings.
I like tabs aswell. I had this long ass disccusion recently where he was all "space", if i had to press 4 times the space bar for everything and perhaps even remove them again I would go nuts.
[QUOTE=Zeh Matt;51683400]I like tabs aswell. I had this long ass disccusion recently where he was all "space", if i had to press 4 times the space bar for everything and perhaps even remove them again I would go nuts.[/QUOTE] [QUOTE=helifreak;51683073]Pretty much every text editor that's not notepad supports tab inserting spaces.[/QUOTE]
Spaces are pure elitism tbh Clarity of code is a tool of the bourgeoisie to control the masses
I use spaces because everyone uses spaces (at work and generally). I single-press indent with tab so no problem with space-slamming, and reverse indent with shift-tab (works in every IDE I use). [QUOTE=Drury;51683506]Spaces are pure elitism tbh Clarity of code is a tool of the bourgeoisie to control the masses[/QUOTE] long lost brother of [url=https://facepunch.com/member.php?u=461314]zelpa[/url]?
Why hate tabs? Because they are simpler. Programmers hate simple things!
Use tabs for indentation, spaces for alignment.
I don't really care as long as it's consistent to be honest.
I use tabs because you can customize their size in nearly all modern editors.
Yeah, tabs are the master key? Tabs forever!
Tabs are life <3 (4 spaces wide)
I just end up using spaces because it's enforced in one of the languages I use, and recommended in the style guide for the other language I use.
Static languages would be tabs typically but otherwise spaces.
I just never indent
[QUOTE=zakedodead;51689234]I just never indent[/QUOTE] Maverick
Who uses tabs or spaces? I write everything to one line. :godzing:
I find spaces gross. I don't want to press backspace 4 times when I could press it just once to un-indent.
[QUOTE=RonanZer0;51710978]I find spaces gross. I don't want to press backspace 4 times when I could press it just once to un-indent.[/QUOTE] Good editors take care of that for you too (and have Shift+Tab for dedenting anyway).
vim users would press d0 to delete to the beginning of the line or 0 to just go to the beginning of the line
[QUOTE=DrTaxi;51711634]Good editors take care of that for you too (and have Shift+Tab for dedenting anyway).[/QUOTE] Then what's the point of using spaces if they act exactly like tabs? Either spaces are used by spacing/backspacing 3-4 times (ew) or they act like tabs, in which case what's the point?
Everyone who uses tabs seems to think spaces users press the space/backspace 4 times manually to indent which is simply not true. They still use tab key to create 4/8/whatever spaces manually and shift-tab to remove them. The biggest difference is that tab users can specify a tab width after the fact, thereby altering any file that uses tabs to whatever space indent they want. Spaces users can specify the tab width before, meaning anyone who uses the file later has the same tab width. The most obvious way this is visible is if you use parentheses or some other alignment scheme to make function calls/assignments/whatever prettier. For example, what may look good with a tab width of 4 may look awful with a tab width of 8 (which is basically any project on Github that uses tabs with argument alignment).
Sorry, you need to Log In to post a reply to this thread.