Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
fdgram4866yIt doesn't matter what style you prefer, one always uses the already established style of the codebase.
-
devios157016yI read recently that people who use spaces are paid more on average… which makes total sense when I look at my bosses.
-
fdgram4866y@devios1 because one group is better at making money, and the other is better at programming? 😃
-
@filthyranter well I need to use xcode and it doesn't have a soft tab option so I can't
-
@devios1 yes because the people using spaces force the good developers out of the company. When they are the last one left, they threaten to leave too unless they get a raise. Managers will make it happen for fear of loosing the entire team
-
@Noob I'm confused as well. When you hit the tab button, does it insert 4 spaces, or insert a tab that is the same width as 4 spaces.
The former is just using spaces, you just happen to be using the tab key on your keyboard as a shortcut -
Noob64606y@practiseSafeHex you insert 4 spaces as you press Tab.
Tabs won't always be the same width, so you can't anticipate them to be 4 spaces.
@Commodore unfortunately I've seen people smash space 4 times. -
@Noob 🤤🤤
As far as I know, any decent text editor is able to convert tab to spaces (btw 4 spaces tends to be the convention in oop languages but js is leaning towards 2)
How the hell can you work while mashing the space key? -
@Noob This is the difference between soft or hard tabs.
A soft tab editor will read the number of spaces you have set, and treat each multiple of those as a tab. When you hit the tab key, it will insert those number of spaces and display it to you as a tab. But when you look at the contents via git (for example) you will see only spaces.
A hard tab is when the tab character is inserted. It is up to each editor or renderer to decide (for example) how many pixels width to make the tab display as. Most editors that use hard tabs (that I know of), give you the option of deciding how many <width-of-a-space-character> to display the tab as. -
@Noob So if we were both using soft tabs, and I had mine set to 4, and you had yours set to 2. You would see 2 "tabs" everywhere I see 1. This would cause alignment issues down the road because as you start to insert tabs, there isn't enough spaces for mine to see them as tabs. Our code would end up all over the place.
If we were both using hard tabs, and I had mine set to be the width of 4 spaces, and you had yours set to be the width of 2. We could both code away with our desired indentation widths, without pissing the other off, or causing merge conflicts. -
fdgram4866y@practiseSafeHex in that case your text editor should be smart enough to figure out the indentation width is 2 and configure itself to that in that file.
The problem then becomes that you have to use 2-wide indentation which is a pain in the butt when you are used to 4-wide. The solution: tabs. They can be set to any width that _you_ personally like.
"Oh but then alignment breaks because everything looks different for everybody". Easy solution: don't align things, it's unnecessary, or if you really have to, use spaces.
Tabs for indentation, spaces for alignment. -
Noob64606y@practiseSafeHex Now I recall reading about this some time ago.
I use Sublime Text for all languages and it always uses 4 spaces when I hit tab.
Guess it's set to soft tabs by default.
Thanks for the detailed explanation! -
Noob64606y@Commodore I don't know how someone can smash his space so many times. It seems redundant and tiresome.
-
joykill3406yThis is why you have automated linting tools...
Use whatever you want in your Ide and have the l'inter change it to whatever the repo has defined as standard...
Problem solved, everything is uniform and everyone can use his style when coding...
Related Rants
Colleague: Oh i've noticed your PR uses tabs instead of spaces, we use spaces, can you change yours please?
Me: ..... can you leave the building immediately, for your own safety
rant
rage
spaces
tabs