this post was submitted on 17 Jun 2023
6 points (100.0% liked)
Programmer Humor
32410 readers
361 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Tabs make more sense because that’s exactly what they’re for, indents. Ignoring how it looks, which makes more semantic sense for an indent, or ? You wouldn’t use a bunch of spaces to indent a paragraph, so why would you use it to indent code?
I was pro tabs when I started out with software development. It just made sense, right? You press the key once, you get a single symbol, you have your indention, neat. And there is the argument that everyone can adjust their tab sizes, want it to be 2 spaces? 4? 6? Whatever? Awesome!
Then you write actual code and this perception changes. Tabs make a mess, developers often align both code and comments to make sense. That alignment only works at x-spaces and utterly breaks if you change tab width.
An example in C# with LINQ (just semi-random stuff):
This kind of indention only works with spaces, not with tabs. And no, mixing tabs and spaces doesn't work (like some users claim, that you can indent with tabs and then do alignment with spaces.. nope, if you change tab with then your space alignment breaks).
Honestly, I don't care either way, I just use what my company uses and adapt. But till now it has always been spaces (even though I was team tabs in university) and now I actually prefer spaces as it just makes sense. It's consistent, it's easy, it works everywhere.
Btw. the Lemmy code editor is shit, trying to align this was trial and error for a minute :-/
No, it doesn't? Here's the exact same text content with different tab widths:
The tabs are smaller but the spaces are the same, so the alignment remains.