I am a full stack engineer and have been coding since I was ~12. My primary focus is to create beautiful, stunning experiences with the best designers available. In tandem, I push to keep perf. bottle
Most importantly, consistency matters more than anything else... Consistent with your team, the languages requirements, style guides, all of these things need consideration. That being said, tabs. The answer is clearly tabs.
tabs is the indent character, and it creates smaller file sizes.
But it could look different on other peoples machines!
Exactly, you should respect other people's preferences of logical indentation. I could use my preferred indent of 2, and other people, godless swine that they are can have 8 if they want...
But how do I?
publicintadd(inta,intb,intc){//And get this to line up?}
For example in Python basically everybody uses spaces (some two, some four), the style guide favours spaces. Same for Ruby. Go uses tabs and that's it.
I tend to adhere to commonly shared style guides. Also, let the lint tools format your code, they are better than humans :-)
Don't care, my editor should auto-format on save to whatever is the project- or language-standard is (Prettier JS, gofmt etc.)
Without those, I'd stick to tabs, because it exists for the exact purpose of aligning lines, as opposed to spaces, which don't.
If no style guide exists, spaces because it keeps the whitespace simple.
You're already using spaces in your code, say:
Thing thingOne = new Thing(); // Spaces in between each item
Thing thingOne... // and spaces before!
So why introduce another whitespace character? Now deleting a whitespace has different effects depending on where it is. Now I have to :set list to see whitespace to be able to edit a file and know what's going to happen.
[tab][tab]Thing[space]thingOne[space]...
Btw, no one is hitting their space bar 4 or 8 times. You hit tab button to insert spaces to the next tabstop or shift-tab to delete to the previous.
first time I saw people using spaces other than tabs I couldn't believe. it takes one click for tabs while three/four for spaces. I think it's only matter of personal preference and you will not change other person states of mind.
#tabs
One Reason: It saves your time
This is a common misconception.
No one presses their spacebar 4 times. The tab button inserts spaces to the next tab stop and shift-tab removes them to the previous tab stop.
Tabs configured to be either 1x Tab or 4x Spaces, depending on the official style guide of the language being used ;)
.editorconfig
Most importantly, consistency matters more than anything else... Consistent with your team, the languages requirements, style guides, all of these things need consideration. That being said, tabs. The answer is clearly tabs.
tabs is the indent character, and it creates smaller file sizes.
But it could look different on other peoples machines!
Exactly, you should respect other people's preferences of logical indentation. I could use my preferred indent of 2, and other people, godless swine that they are can have 8 if they want...
But how do I?
Well you just...
would make for a good discuss in future tho....
Use shared conventions.
For example in Python basically everybody uses spaces (some two, some four), the style guide favours spaces. Same for Ruby. Go uses tabs and that's it.
I tend to adhere to commonly shared style guides. Also, let the lint tools format your code, they are better than humans :-)
Don't care, my editor should auto-format on save to whatever is the project- or language-standard is (Prettier JS, gofmt etc.)
Without those, I'd stick to tabs, because it exists for the exact purpose of aligning lines, as opposed to spaces, which don't.
You're already using spaces in your code, say:
So why introduce another whitespace character? Now deleting a whitespace has different effects depending on where it is. Now I have to
:set list
to see whitespace to be able to edit a file and know what's going to happen.Btw, no one is hitting their space bar 4 or 8 times. You hit tab button to insert spaces to the next tabstop or shift-tab to delete to the previous.
first time I saw people using spaces other than tabs I couldn't believe. it takes one click for tabs while three/four for spaces. I think it's only matter of personal preference and you will not change other person states of mind.
This is a common misconception.
No one presses their spacebar 4 times. The tab button inserts spaces to the next tab stop and shift-tab removes them to the previous tab stop.
Well, maybe most of the people use like this, but I saw people hitting space.
Do you ever find something really interesting but at the same time can't be bothered researching?
For example "why is the tower of pisa bent?", I find it so fascinating but not enough to search it on google!
Equally fascinating is why on earth is this a topic of discussion. One tab vs 4 space!
I must be wrong but I can't be bothered researching it
:)
Lingering Spaces and the Problems of Overformatting
Tabs save you file size
I don't care as long as it's consistent. The consistency should be enforced in an automated way, eg a tool run on a CI server.