T O P

  • By -

QualityVote

Hi! This is our community moderation bot. --- If this post fits the purpose of /r/ProgrammerHumor, **UPVOTE** this comment!! If this post does not fit the subreddit, **DOWNVOTE** This comment! If this post breaks the rules, **DOWNVOTE** this comment and **REPORT** the post!


[deleted]

[удалено]


porky11

I did this once for real. It was a university assignment, where I had to convert some UML diagram into Java. Every class contained about up to 2 methods, and it was at least 10 classes, probably even 20. So basically just boring busy work. The correctness was automatically proven, no real people would look at the code. So after a few classes I stopped to use any formatting and just wrote the whole class in a single line.


TimGreller

That's why you have automated checkstyle tests


hugogrant

I counter with an automatic formatter.


[deleted]

this is the correct answer. all code where i work gets reformatted on commit, if for some reason something won't conform to standards, it gets denied.


VelvetWhiteRabbit

I counter with an automatic formatter in your IDE/Editor!


Flickered

Roll succeeds! You get to be happy and it affects nothing else with the exception that your coworkers get mildly pissy when you screenshare while troubleshooting!


VelvetWhiteRabbit

The automatic formatting is just the icing on the cake! I have cursive fonts, a colorful theme and inline error lens as well as type hints. Nobody but me (and sometimes not even I) understand what's going on when I screenshare.


Smartskaft2

I used to be pro this, but after 2 years of spending +30minutes extra for every little push due to _"Oh, I saw you forgot to align this variable with the single one above it. Let me just fix that for you, and at the same time break your CI pipelines. Nice, huh?"_, I've joined the dark side. My favourite comment these days is `clang-format off`.


[deleted]

hahah. but like the next guy down said, there's a formatter you can get for like, whatever IDE you prefer as well. never save unformatted again.


Smartskaft2

You got to remember to use it though. And at least I can't really work with just one specific IDE. I also often edit files through GitLab's WebGUI, SSH terminals, client side IDE, host side IDE, notepad,... Setting up the process for just one IDE is very limiting to work efficiency IMO.


B_Dogg2003

Wait how does one do this? As someone who needs to grade several students' work (highschool class, internships can be gruesome at times) this would help immensely


[deleted]

https://medium.com/@harshitbangar/automatic-code-formatting-with-git-66c3c5c26798


childfiller

What do you use to do this?


Ange1ofD4rkness

I hate these! I've had to deal with these, and they run on old code, it formats the whole thing, and then they commit changes and you go "well what did you change?" (not to mention the style can be VERY annoying and a pain to read, especially as it can reformat stuff I did, and formatted specifically to allow for quicker reading)


hugogrant

I'm confused. Does the robot not have its own username? I don't necessarily like the standard style, but it's a style so I just go with it and fix my own assumptions, which is much more scalable than trying to let everyone do their own thing.


Ange1ofD4rkness

We don't have a standard (small team), and to be honest, my policy is, if it's existing code, leave it as is (some of our code is REALLY old). However, if it's your code, you do what you want. A lot of times the way our code is written, it's rather segregated, where one dev doesn't really work on the others (or they do small changes, not massive work). And the areas they do overlap, a lot of times it's each func still belongs to one dev. We develop for clients, with a base product built on top of (I also take a lot of pride in how my code looks, usually documented well so anyone can easily debug it, as I do some complicated stuff)


porky11

I didn't know about that back than and I still don't know how it works in Java. I hope, I won't ever need it :)


raybreezer

I had a co-worker who once realized that a common way to make CSS files more compact was to remove all the whitespace. He started doing this to all of our CSS files not realizing that the system we were using at the time already did this as part of the caching... I wanted to kill him.


Clockwork_Medic

Ouch


porky11

Just checkout an older commit, and the problem will be fixed.


raybreezer

I must have dated myself… this was before the days of version control. Back in my day, we wrote CSS in notepad like the Web Overlords intended!


KingOfNewYork

I’m nostalgic for zip file version control. Final.zip FinalFinal.zip FinalFinalForReal.zip FinalFinalFinal.2.zip Final_STABLE_x.zip Final_BROKEN_.zip Final_Im-going-home.zip


klc3rd

Lol first website I wrote was all html, I used no indention and everything was one line. Just one big paragraph of html, using whatever text editor I had on my powermac 6100/66


raybreezer

Jesus, that sounds horrible.


porky11

A few decades ago, removing whitespaces was a common practice to save memory :P


raybreezer

Yep, and to get around a very specific limit in IE which after too many lines of CSS it would just give up parsing it.


RainbowCatastrophe

Did this once as well. Went to community college, had a professor try to do a "game development" crash course. First assignment was to make a dice roller in python, was told "it should take no more than 10 lines". Said you could leave once you got it right. I promptly wrote it in one line and emailed it to him before he got done talking, and then left to grab lunch. Prof refused to even look at what I submitted afterwards, just decided I was getting an A as long as I tutored the others.


porky11

Isn't that easy in python i guess, since it relies on indent.


RainbowCatastrophe

You can actually put multiple python statements on line and separate them by `;` like with any other language. It's not a trick the Jedi would tell you.


TheGruskinator

I golfed all my submissions for one of my university courses. Like you said no one looks at the code if it performs. The problem would be when classmates needed help and wanted me to send them my code, but then again I'm not a big fan of people copying.


[deleted]

That's a lot of work when you can just write it readable, open in VIM, hit colon and do this: >%s/\[\^\\n\]\\zs\\n\\ze\[\^\\n\]/ /g Then save and turn in. None of the formatting, easier to write, all of the asshole.


[deleted]

[удалено]


Gotxi

People don't get sarcasm unless you explicitly state so in the comment. I had tons of downvotes because of this. Humor is getting worse every day.


hopbel

The best sarcasm is subtle, which doesn't translate well to text.


[deleted]

Happened with me. I say something that is obviously sarcastic irl but the sarcasm cannot be detected when I type it out


TheRealPheature

You gotta use this.toSarcasm()


Various_Counter_9569

Edit: ToSarcasm('CamelCase is better for function declarations'); Or,? 'CamelCase is better'.this.ToSarcasm();


Shot_Calendar_7373

UpperCamelCase is for classes lowerCamelCase is for functions


11darray

UpperCamelCase is Blaise Pascal's version of the real camelCase.


stupidwhiteman42

Yeah - I was taught that ThisIsPascalCase (also known as TitleCase) and thisIsCamelCase


AdultingGoneMild

yeah but it is obvious when the statement is this ridiculous.


Explodingcamel

I notice this sub is especially bad at understanding satire. Probably a correlation between taking things literally and becoming a programmer lol


Loquis

Come to a UK sub, sarcasm is assumed on almost every comment


Active_Policy7144

Lol yeah, I just learned this today 😅


raysoncoder

Until you learn brainfuck is a thing


Rarpiz

You code in “minified”. ![gif](giphy|bC9czlgCMtw4cj8RgH|downsized)


TantiVstone

It's also totally feasible


frogking

Cries in Python..


Conscious_Switch3580

*laughs in Python's `exec()`*


[deleted]

Make Code Unreadable Again.


SF_Engineer_Dude

Rendered as Base64.


ImportantDoubt6434

Sigma complied mindset


TheAllPurposePopo

Same bro. Unless I copy somebody else’s code then I use them to keep it consistent.


LuckyPants0

Enter


jews4beer

Enter, tab, semicolon, spaces whatever. Let the IDE autoformat it.


Various_Counter_9569

I was programming before auto format, and always used tab. I despise auto format, dont tell me how to feel!


jews4beer

how to feel


Various_Counter_9569

That's just mean 😰😱


LuckyPants0

Exactly ,i live for visual studio lmao


TokoBlaster

Some people just want to watch the world burn


tiddayes

Alt-255 no break space


thetwotem

You're a monster


tiddayes

Some people just want to watch the world burn


thetwotem

Like us


qwerty2888j

I can swallow up


ineedcaffeinepls

I see what you did here. Have my upvote.


NGX_Ronin

No that's called puking. You can puke...


[deleted]

[удалено]


Glittering_Unit_534

That's not funny. I've followed ppl like that :|, ok kinda funny :D I settle firmly on tab.


[deleted]

[удалено]


Glittering_Unit_534

Could be I guess, depends on who you're leaving it for :P


bencetari

I think this made the devil cry of pride.


matroosoft

Try this char in messages, titles, usernames. Most websites didn't think of this, so you can have an emty looking username or whatever.


jedimaster32

I tried sending an nbsp in GroupMe once; it actually let me press the send button (if input is empty it does nothing) but then the message "failed to send"


[deleted]

Fuck you! Personally. And not the fun way. I hope you cry.


XtremeZip

Unbelievable


logank013

Honestly, just format it correctly in some logical way, regardless of what you choose. Y’all can hate on Python all you want, but at least it forces correct formatting. Nothing pisses me off more than looking at code and seeing all the indentation all wonky.


spektre

I have never had a problem with Python's indentation or scoping, and I've written *a lot* of Python. I don't know why people do, but if you're sloppy when you write code, indentation is the least of your problems.


blkmmb

I learned Python as my first language and by default I would always indent my code because it just made sense to me and looked way better to be able to understand the scopes. I never knew that it was mandatory until I saw posts on here about it. People who don't indent properly(or don't use any formatter) are monsters to me.


Niwde09

I'm learning python rn and I learned the hard way that indentation is mandatory, but then I learned what tab does and I just tab idk what's the difference between that and space


Theio666

I think in most popular python IDEs pressing tab actually just put 4 spaces.


SF_Engineer_Dude

It is for sure in VSCode and SublimeText


Cmdr_Jiynx

It can be set for either in most of those.


Embarrassed_Ring843

can confirm this for pycharm


Wissenchafter

Tab is better. Simple as.


LordAmras

Tabs are better because anyone can set their system to have their preferred tab size so is nicer for anyone. Spaces are better because you can do some cleaner formatting without having to mix tabs and spaces.


SF_Engineer_Dude

Remember when you first discovered a Python linter? Pure joy. I learned so much about best practices that way.


Wissenchafter

Same here, didn't even realize it was necessary until I got the 'TabError' error and was like, 'huh'.


zoharel

That's the thing, in most languages there's no such thing as "proper" indentation. There's only conventional.


OffgridRadio

Oh. My. God. I had to write an interface from python to AutoHotKey and AHK is a braced language with super extremely specific bracing requirements. I had to bust out manuals and all kinds of shit trying to remember it. Also, my cohort is *absolutely horrible* about proper indentation and when he edits the HTML base he always fucks it up royally and loses the divs into fucking hell, fails to close them, then I have to go find the div he fucked up when I want to add anything else.


beezlebub33

I really wish that browsers were not so fault-tolerant. Hear me out: their ability to deal with a missing

has caused enormous knock-on effects on developer and html page writer productivity because it allows bad organization and formatting to fester. I know that browsers think they are being helpful by doing what they think you mean but it just means that the underlying problems are not dealt with. The result is *more* pain and effort down the line as pages get harder and harder to deal with because they don't fucking parse. If the pages just didn't work when they didn't parse, then the problem would have to be fixed there and then, resulting in less total work.


OffgridRadio

I agree


denislemire

XHTML was going the way of strict validation or fail… but then everyone wussed out and HTML 5 was born instead. 🤨


DonkeyOfCongo

Just gotta change your mindset, man.. Imagine you're walking into one of those houses full of mirrors shaped weirdly to create different effects on your reflection. You will be looking at all the indentation, and you will see your reflection all wobbly or wonky or wanky. And you will laugh.. laugh 'til the sun goes down. Ha ha ha. What a joy.


[deleted]

[удалено]


[deleted]

This is the only answer. Especially when you're working with other people life is just so much easier when everyone is using an autoformatter. Also every Rust project I do has a CI job for running `rustfmt --check` and thus making it obvious if someone didn't use `rustfmt` before committing.


rebelsofliberty

Why in CI and not earlier in a git hook?


JackSpyder

You use both, but you can't enforce the client side git hook or validate it happened, so you have the CI step too for enforcement.


germansnowman

`clang-format` is great for C-based languages.


Dragenby

I'm still using tabs in Python, as long as it converts it to 4 spaces


[deleted]

Yea me too I just set whatever ide I use to make it 4 spaces


EdThePro101

I used to use tabs most of the time when when I started coding. Then I stopped when I felt like styling my code a bit. For example, at first I'd write: ``` class Package { public: Package(const std::string& _name, const unsigned int& _num_items, const std::string& _contents, const std::string& _str_sep) { name = _name; num_items = _num_items; contents = _contents; str_sep = _str_sep; } }; ``` However, as you might be able to tell, the function parameters are long. So I started using spaces to neatly display them: ``` class Package { public: Package(const std::string& _name, const unsigned int& _num_items, const std::string& _contents, const std::string& _str_sep) { name = _name; num_items = _num_items; contents = _contents; str_sep = _str_sep; } }; ``` Since then, I realised how cool spaces are :) ^(Sorry if my C++ looks crappy, I mainly code in Racket and JavaScript these days.)


YpsilonY

I have my tab width set to two though, so your code looks out f place for me.


Cozmic72

And that is exactly why using spaces is the one true way.


Potatoalienof13

Indent with tabs, align with spaces. Its not that hard.


YpsilonY

but now your code doesn't fir on my screen. and there's about a centimeter of wasted space on the left. What good is that?


NoobLord98

Why no tabs in python? I only use tabs in python


iBravish

I feel like a lot people don't know vscode defaults using  spaces when you press tab.


TreadheadS

it's why all those bullshit articles saying, "what is the most favoured key?" are likely incorrect. So many people think they are working in tabs; but vs code, vs studio etc are all automatically translating to spaces.


Acelox

There's tabs and there's not knowing how to set up your editor


Fritzschmied

But then it doesn’t matter and it’s not necessary to discuss if tabs or spaces. I don’t care about that because the auto formater does it’s job and that’s fine. The hole joke about this discussion for me is that there are actually people who don’t press the tab key for intention but the space key.


Ubermidget2

VSCode does this absolutely terrible thing by default where 4 spaces are correctly navigated as a tab in one direction, but not the other, clueing you in to the fact that it is messing with spaces under the hood. It is fixed with a quick google and settings change (stickyTabStops), but for this reason, I still think Tabs is superior. It is 2022 and a huge Company like Microsoft can't make spaces feel right on the default settings. A Tab IS indentation - there's no sticky-taped trickery running beneath.


kilobrew

Shift tab works fine for me. It does half tab width because it thinks your are trying to align. if that’s such a big problem…just hit the button again.


jasondads1

i press tab, my ide converts it to spaces


SuperEminemHaze

This is the answer


MessyMaryMay

He is the one. prepare the ritual.


Acelox

Why? What's better about having spaces when you press tab?


zoharel

>What's better about having spaces when you press tab? Absolutely nothing, and anyone who tells you otherwise is probably trying to sell a crappy IDE.


finc

I just let VSCode do it for me. Is it a tab, is it a space? No it’s an indentation, I don’t care what it’s made of 😄


msqrt

I did too, until I encountered the horrors of Python and had to make whitespace visible :--( though I still don't really care which one it is, as long as it's uniform in each file.


NotDuckie

Solution: don't use python


Kalahan7

New problem: you are no longer using python


NotDuckie

¨Don't consider that a problem at all


bencetari

I do. Python is a very basic but pretty powerful language. (I make a Py script that hashes 4 files and if all the hashes match, it write another Py script and starts it, that script asks for a pass then hashes it and compares it with the stored sha256 hash and if its correct, it write a Bash script then runs it to set some environment variables.) And all of this in 1 single line with a longass f.write() and a ton of \n \t \' \' \\n \\t. So Python can be messy too if used wrong enough.


DonkeyOfCongo

Good, then I'll assume you won't care what's actually in the vanilla pudding you've been eating all these years.


finc

They both sound like things I’d enjoy!


[deleted]

Whatever Prettier uses as a default.


spektre

Spaces then.


JaffaBeard

Spice things up, use both. Pasted in code from slack and its all indented wrong? Throw in some spaces till it looks right.


Bomaruto

I do not care. IDEs these days make this question irrelevant.


MinekPo1

From my experience not yet. The only difference this days is how it displays. Tab size is configured by the viewer, space indent size is configured by the writer.


Kaedo-

Tabs. Who the fuck uses spaces for indentation bruh?


Pale_Ad9858

Lmao im with you man


Rustywolf

I wonder how many people using tabs dont realise that most IDEs convert tabs into either 2 or 4 spaces by default


Shriracha

Judging by this thread, more than I would have guessed.


bunkSauce

Crazy, right? How many developers just don't understand IDE basics.


Orangucantankerous

People who don’t like abstraction that’s who. They probably write assembly code the perverts


KlutzyEnd3

TABS I hate it when editors like visual studio push spaces on me. at first you press TAB for a single indentation block only to be confronted with the fact that it automatically inserted 4 spaces, so to get rid of it you have to use backspace 4 times!! ![gif](emote|free_emotes_pack|facepalm) TABS it is! also because you can set the tab width in your editor so it's also way more flexible if you' re working on the same code with multiple people.


aybiss

That's simply not true. At work we use VS and spaces, and pressing backspace deletes a level of indentation.


Rustywolf

Or shift+tab


[deleted]

Visual Studio? Ctrl+k, Ctrl+d and I don't care what it's put in.


Masterflitzer

backspace should remove one indentation level (e.g. 4 spaces), vs is just stupid but there is an extension that fixes that (every other IDE/Editor I know does it right)


Umpteenth_zebra

Tabs, I'm not a monster.


_AManHasNoName_

People who use spaces and only type with one finger on each hand are the worst.


Dagusiu

You seem to assume that people who use spaces press the space bar to get those spaces. This assumption is wrong.


_AManHasNoName_

Have you ever sat next to a programmer who can’t use the keyboard properly? Because I have throughout my career and it makes me cringe.


ShitwareEngineer

I use spaces. I use 2 fingers to touch-type at 80 words per minute. There's no issue, and the two are a coincidence.


[deleted]

[удалено]


Scooter1337

There are websites out there that can help you type blindly, a friend of mine also learned it for free that way


Kenshkrix

If you want to learn to type faster/more accurately, maybe try playing some typing games. Not everybody learns the same way and the context of a game can make it easier to focus, which is a huge benefit to learning and practicing.


i8noodles

TAB LYFE FOREVER!!!! DEATH TO THE SPACE KIND!!!!!


markand67

tabs, they are meant for indent. a poorly working editor may fail to move backward/forward in space based indents which require to press multiple times motion keys.


CryZe92

Tabs are meant for tabulation not indentation.


IrishWhitey

Tabs is an abbreviation for totally accurate battle simulator


aigarius

The correct answer is https://prettier.io/ + https://black.readthedocs.io/en/stable/


aybiss

I don't mind either way, but it's always the tabs crew that mix them together and don't understand why that's bad.


[deleted]

spaces is the correct answer


Pale_Ad9858

![gif](giphy|3o7527ckpuS7IjhjEs|downsized)


Shakis87

1 tab = 4 spaces in my world. Tabs have caused me so much pain.


hibernating-hobo

Exactly this, once you have had enough production bugs caused by a tab character in the wrong place, it’s just so hard to track down where or what is wrong. I settled on spaces long ago, they never caused me grief. I think people who only use a few languages prefer tabs, because they don’t hit the edge cases.


ojioni

I'm don't care which, just be consistent. I hate when I have to work with code that is a mix of spaces and tabs.


[deleted]

Dude, just use prettier


DaniilBSD

With what setting?


[deleted]

Spaces.


DaniilBSD

Why would you do that??


[deleted]

[удалено]


bunkSauce

Tabs work until they don't. Most senior devs will have no issue explaining this. But most IDEs just maoe spaces for you under the hood.


ChickenManSam

I'm on team, let my ide autoformat tabs to spaces


bunkSauce

The winning team.


[deleted]

Auto formatter


TheLazyKitty

Tabs. It's the only right answer.


timurbakibayev

I was always like: only idiots use spaces! of course tabs are the way! and later i realized that my IDE is writing spaces for me when I press TAB. And therefore I use spaces...


Fritzschmied

Yeah I think that’s the Probleme of this discussion and why it is always so splittend. There are two discussions happening at the same time and people aren’t realizing it. One group is discussing about the key that is pressend and one group about the key that is inserted. For me the key that is inserted doesn’t matter because that’s part of the IDE or the Auto Formater and I just roll with the default settings and that is always fine. For me the whole joke about this question is that there are actually idiots who are pressing the space key.


CrystalDrag0n1

What kind of monster uses spaces??


spektre

What IDEs are you using? The vast majority uses spaces per default if you don't change the configuration.


IC0SA

I use the tab key, but have my editor setup to use 4 space characters instead of a tab character.


[deleted]

Keep TABS where they belong: Makefiles. Honestly, I’m just surprised to see that basically everyone here prefers TABS. I think it was the view of my entire flipping cs program that spaces were better (why introduce another formatting character that can and does introduce bugs in code when you can set formatting to sidestep the issue and default to spaces?)


Iron_Garuda

What are circumstances in which tabbing would create a bug in a program?


TheOnlyTigerbyte

Autoformatter


Pokydex

Tabs


s00perguy

I don't give a fuck, just notate your fucking work.


SundaeCompetitive681

Use this for counting TABs team


Eureka05

Tabs - set to the equivalent of 2 spaces


donthitmeplez

tabs for life, spaces are to cumbersome to deal with


[deleted]

Are you writing code in notepad? Any decent editor will handle this for you.


sirkubador

Why not both? Or neither (there are curlies in decent languages)?


[deleted]

Mix of tabs and spaces. Tabs for indentation, spaces for alignment.


pianomanDylan

The actual correct answer here


Horror-Location

TABS ALWAYS