View Full Version : Tabs or spaces?
Confused_panda
March 31st, 2019, 04:05 PM
One for any programmers that might be floating around (if there are any). As per the title really.
I was trying to explain this truly bizarre argument to someone the other day and it got me wondering - which side are people on in the great programmers divide?
Turbofan explosion
March 31st, 2019, 08:47 PM
I always press the tab button because having to type 4 spaces in annoying.
And I use python the most, which uses tabs to divide code blocks.
PlasmaHam
March 31st, 2019, 09:10 PM
I use vim for most of my coding right now, since I'm dealing a lot with files and bash scripts, and it's just easier to stick in a terminal environment. I managed to modify the vim config file so that a tab results in just 3 spaces, instead of a tab. This prevents the problems with varying tab length, and also saves me from constantly using the spacebar.
LiberalTurboprop
April 1st, 2019, 10:41 AM
I mostly do Java stuff so the argument is kinda irrelevant other than having nice looking source code but I use tabs to save time. I don't care about everything being exactly right-looking, just good enough for me to follow.
Confused_panda
April 1st, 2019, 03:26 PM
Good to know! I don't understand the spaces thing - why would you want to batter the poor space bar like that?
I use vim for most of my coding right now
Man, I'm sorry. Did you lose a bet or something? Is it some sort of punishment? :lol:
EDIT: 50th post! Woo!
THE_D3_4D_3Y_35
April 1st, 2019, 09:20 PM
Why hit the space bar so many times when you can just hit TAB once haha.
Spooky_Eli
April 1st, 2019, 09:23 PM
Why hit the space bar so many times when you can just hit TAB once haha.
Ita a bit like the USC, smaller equals "more accrete"
PlasmaHam
April 1st, 2019, 11:02 PM
Man, I'm sorry. Did you lose a bet or something? Is it some sort of punishment? :lol:
Lol, not quite. I'm taking a programming class right now and the teacher does not want us to be using an IDE. Most of the class is using gedit, but I already have some experience in vim from a Linux user class I've taken, so I've stuck with it.
There's definitely a learning curve, but vim is arguably one of the most powerful text editors once you get it. I only know a handful of commands, but enough that I can use it with relative ease and practicality. The only thing that is annoying is the lack of an effective way to copy-paste code, I guess due to it's nature as a command-line program.
Confused_panda
April 2nd, 2019, 10:42 AM
Lol, not quite. I'm taking a programming class right now and the teacher does not want us to be using an IDE.
Oh god, seriously? What sort of weird sadist are they? Programming is hard enough to learn without adding your own barriers to jump over.
What language are you doing?
PlasmaHam
April 2nd, 2019, 02:00 PM
Oh god, seriously? What sort of weird sadist are they? Programming is hard enough to learn without adding your own barriers to jump over.
What language are you doing?
C. Frankly not having an IDE is fine with a procedural language like C. I'm doing some stuff on my Raspberry Pi in my free time anyway, and that doesn't really have the processing power to run a good IDE so I have to use vim if I want to code and do basically anything else at the same time. However with object oriented code I'll definitely be using an IDE, regardless of teacher recommendations.
Confused_panda
April 2nd, 2019, 04:26 PM
C. Frankly not having an IDE is fine with a procedural language like C. I'm doing some stuff on my Raspberry Pi in my free time anyway, and that doesn't really have the processing power to run a good IDE so I have to use vim if I want to code and do basically anything else at the same time. However with object oriented code I'll definitely be using an IDE, regardless of teacher recommendations.
Yeah, C/C++ don't have too many options I suppose - although Geany isn't totally terrible for what it is.I tend to use Python, so there are all sorts of options available.
I really need to write more OO code. I understand the concepts, but just never feel the need to use it in any of the programs I write. It's a bit of a shift in thinking to get right.
antandlope
April 6th, 2019, 04:52 PM
Usually tab... I program in Swift and VB, and tab is more accepted/accurate. Spaces can go wrong if you do one more/less than your supposed to... then you have to go fix it... how annoying haha
sportskid2006
April 12th, 2019, 10:30 PM
Tab is way better
Brightwolf
April 14th, 2019, 01:59 PM
One for any programmers that might be floating around (if there are any). As per the title really.
I was trying to explain this truly bizarre argument to someone the other day and it got me wondering - which side are people on in the great programmers divide?
Both, usually tab though. Some languages require a specific number of spaces or tabs (looking at you makefiles, and Vpython...) but tabs are quicker and easier.
Liven
April 16th, 2019, 04:09 AM
I use tabs to save time - cause time saved is more time coding, and working on the project at hand.
bonbon
April 24th, 2019, 05:05 PM
Spaces. Though I always configure the editor so that the Tab key actually inserts 4 spaces.
I always indent by increments of four spaces, unless I'm editing a project with a different indenting convention (and then I try sticking to it).
Tyler111
May 1st, 2019, 10:33 PM
I use tabs in Java. Makes it look a lot neater and takes less work.
Gamer.
May 10th, 2019, 06:12 PM
100% tabs 100% of the time.
It is easier to make the code look cleaner with minimal effort on my part.
Relevant video: https://youtu.be/SsoOG6ZeyUI
JustHaveFun
July 11th, 2019, 04:51 AM
LMAO, did you get this from Silicon Valley? (amazing tv show btw, highly suggest watching it if you haven't yet)
https://www.youtube.com/watch?v=V7PLxL8jIl8
I use vim for most of my coding right now, since I'm dealing a lot with files and bash scripts, and it's just easier to stick in a terminal environment. I managed to modify the vim config file so that a tab results in just 3 spaces, instead of a tab. This prevents the problems with varying tab length, and also saves me from constantly using the spacebar.
Vim is the best, I wouldn't want to use anything else after learning the commands. Search on youtube for "vim lectures" and you can find all kinds of great educational videos on vim commands. That's how I learned to use it.
Good to know! I don't understand the spaces thing - why would you want to batter the poor space bar like that?
Man, I'm sorry. Did you lose a bet or something? Is it some sort of punishment? :lol:
EDIT: 50th post! Woo!
Whats wrong with vim? Do you use emacs or something?
look
July 11th, 2019, 07:24 AM
I press TAB, because pressing 4 spaces all the time is frickin' insane.
But setting the TAB to output 4 spaces is all right, and insures that
all text editors should display the code in a similar manner.
look
July 11th, 2019, 08:13 AM
which side are people on in the great programmers divide?
How about the OTHER great debate:
EVEN or UNEVEN parentheses
Do you go with EVEN:
function(x,y,z)
{
blahblahblahblah;
blahblahblahblah;
return(myMoney);
}
or UNEVEN:
function(x,y,z) {
blahblahblahblah;
blahblahblahblah;
return(myMoney);
}
Of course, the CORRECT answer is EVEN !!
So, to sum this up:
1. Set your TAB to 4 spaces
2. Press the TAB key, not the SPACE BAR times 4
3. Keep open/close parentheses EVEN
Now, the universe is in BALANCE!!!! :-)
Confused_panda
July 24th, 2019, 03:53 PM
Obviously even, I'm not a monster! Although I mainly use Python, so this isn't an issue for me.
Please tell me you indent inside the parentheses though... :D
vBulletin® v3.8.9, Copyright ©2000-2021, vBulletin Solutions, Inc.