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
-
Tabs instead of spaces... Is there anything worse you could do? Nope, can't think of it...
-
Don’t use tabs read about soft tabs always spaces unless the language force like Go and Makefile
-
lxmcf204107y@enclaver I don't align parameters, will use tabs to align variables initialisation though.
Aligning parameters ends up messy imo -
enclaver927y@lxmcf tbh I dont care that looks meesy to you. There are code standards for different languages
-
@enclaver tabs is for indentation, spaces for alignment, it's called smart tabs, available in every ide as far as I know.
-
enclaver927y@Codex404 I dont use ide. I set my editor to insert 4 or 2 spaces when I press the tab key on a keyboard. Is that what you call smart tabs? If thats it, I would say you use only spaces in your source code, which I do also
-
@Condor no,please, nobodu imagines how tabs are set. Blanks are the true white space.
-
@enclaver are you trolling? Or are you just clueless how tab indenters work? Which makes me curious if all spacedenters have this when discussing it?
-
512GB6857yI was a tab fanatic, until I realized you can't have an 80 char limit (or any other number) and also have variable indentation.
But as long as you agree the tab width, you are still good! -
creator22067y2 spaces for indentation is what we follow in our team. We transferred one guy to other team when he used tabs despite giving multiple warnings.
2 or 4 spaces are a standard at most of the teams I have worked with.
Even if you choose tabs, make sure that everyone else in your team follow the same standards. -
I've asked this multiple times but what are advantages from spaces over tabs?
I've tried both quite a lot and prefer tabs myself. So far the only point to use spaces I understand so far is the support for editors like vim where you can't change tabsize for some reason -
enclaver927y@Codex404 i have no idea what you are talking about. My bottom line is: you will not find any \t characters in my source.
-
creator22067y@Codex404 There's no advantage which are important. The only advantage of spaces that I got was I can choose to have 2 spaces instead of regular 4 and if any other developer in my team accidentally uses 4 spaces, the code doesn't break or look ugly. All spaces take same size, thus the IDE settings are also irrelevant for tab sizes.
The other advantage for me is that I can easily paste the code into a markdown file or Stackoverflow whenever needed. I personally prefer 2 spaces, as the code looks better with that to me.
You don't have to actually type spaces. All IDEs know how to convert a tab key into 2 or 4 spaces.
In the end, it's all about the Standard that your team is following. If most of them prefer tabs, go with tabs and vice versa. Just pick one and stick with it. Don't let any other developer go in any other direction.
If you're into JavaScript, I would suggest you to read Douglas Crowford's thoughts on this in his book "JavaScript: The good parts". -
@enclaver
I use:
Tabs for indenting,
Spaces for alignment (for example parameters alignment)
By using the smart tabs option available in almost all IDE's and editors I only have to use the tab key. This way I've the best of both worlds. Personal indent size (Depending on the language I prefer a width of 2, 3 or 4 characters), and nice alignment no matter what tab width you use.
Some C# to explain:
https://pastebin.com/5m9PyqJa ) -
@creator You say you are using spaces, but all I can gather from your story is that tabs are for you...
I also prefer a tab width of 2 or 3 spaces in most languages. By using tabs each person can choose for themselves. Using spaces you cannot really do that (without converting the characters in your ide forth and back)
Related Rants
-
l0om44100% Real. And it's not even the worst on the site.
-
Codazed11Being 100% serious, I saw a guy in my Computer Programming I class using MS Word to write code that he would c...
-
dfox8I worked with a good dev at one of my previous jobs, but one of his faults was that he was a bit scattered and...
Spaces instead of tabs... Is there anything worse you could do? Nope, cant think of it...
rant
wk99