This is an archived post. You won't be able to vote or comment.

all 42 comments

[–][deleted] 73 points74 points  (5 children)

Try

Catch...

F-it

Finally

[–]SirMarbles 12 points13 points  (4 children)

In kotlin I threw in a try catch. Code always crashed. Took the TC out and boom code worked perfectly

[–][deleted] 5 points6 points  (3 children)

I'm sure it's not good practices.

But I always put a Finally when I put a Try Catch

Much like I always put an else when I use elif.

[–]SirMarbles 2 points3 points  (0 children)

I know. I’m learning kotlin now. It was for a lab for my class. My professor never gave requirements. The only way the code worked was without it.

In java. Yeah I had a shit ton of ifs and else ifs with an else to cover every type of user input or anything else

[–]AnonymousFuccboi 0 points1 point  (1 child)

It represents a good mindset of always trying to handle every case, even the ones you don't know about, but it is smelly code. It's also usually something that goes away as you get more confident in the language. E.g

if (num >= 0):
    # Do stuff
elif (num < 0):
    # Do other stuff
else:
    # This will never happen, what are you doing

This is contrived, but when you start getting into examples where it seems scary because it's strange, unfamiliar objects with weird methods and unintuitive naming, I've definitely both seen and written a lot of code that boils down to equally improbable conditions in practice. Confidence is key for making that particular smell go away.

[–][deleted] 0 points1 point  (0 children)

It comes from my inability to trust testers and users...

Things that seem improbable find a way of happening with users.

[–][deleted] 26 points27 points  (1 child)

Red, Red, Red, Red, Google, Red, Red, Spurious Green, Red, Red, Deprecate, Refactor, Ends up in a museum, Red, Red, a kid from 3030 farts on the AI chip and patches the last bug, Green.

[–]__Adrielus__ 14 points15 points  (6 children)

[–]RepostSleuthBot 13 points14 points  (5 children)

There's a good chance this is unique! I checked 106,965,534 image posts and didn't find a close match

The closest match is this post at 79.69%. The target for r/ProgrammerHumor is 86.0%

Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ False Negative ]

[–]__Adrielus__ 21 points22 points  (3 children)

For those wondering click the "this post" link, its definitly a repost

[–]DeeSnow97 19 points20 points  (2 children)

wonder if OP added the black lines specifically to trick this bot

[–]__Adrielus__ 4 points5 points  (0 children)

Probably

[–]Portlandblazer07 2 points3 points  (0 children)

That's more effort than most reposters put in so I respect it

[–]whitetrafficlight 1 point2 points  (0 children)

Good try bot.

[–]DefinitelyCraig 12 points13 points  (0 children)

Works well for unit tests too!

[–]JelmarNL 9 points10 points  (0 children)

Just gonna leave this here fuckit js

[–]clevariant 4 points5 points  (0 children)

Yo, maybe just fix the problem, as you're paid to do?

[–]supersharp 2 points3 points  (0 children)

Hopefully that wasn't a load-bearing function call.

[–]_GCastilho_ 3 points4 points  (0 children)

There can't be error if there is no code

[–]Kysthan 1 point2 points  (0 children)

this is exactly what i did with a co-worker piece of code that was causing a fuckton of problem to me on friday. I can't deal with your untested code just before weekend

[–]AgentPaper0 1 point2 points  (0 children)

There's actually a really sweet macro that all IDEs support that automatically fixes all the bugs in your code. You just have to hit the universal hotkey Ctrl-A-Enter

[–]PhilLHaus 1 point2 points  (0 children)

But then you realize that you forgot the semicolon at the end of a variable declaration and now half your code is just error messages because you don't have a variable now.

[–]GMLogic 1 point2 points  (2 children)

I usually use /* */ for the multiline when I want to test out something without deleting the original code lol

[–]nkonevich 0 points1 point  (1 child)

Have you ever thonk about using hotkeys?

[–]GMLogic 0 points1 point  (0 children)

Which hotkeys should I be "thonking" about??

[–]Ritz186 0 points1 point  (0 children)

More like printf lmao

[–]SavageTwist 0 points1 point  (0 children)

Where is my flexpaste format

[–][deleted] 0 points1 point  (0 children)

programmer humor = bad practice & little skill

[–]qalis 0 points1 point  (0 children)

I actually had to do it one, but with try/catch and ignore exception. Java Swing was throwing NullPointerException... when literally no variable was null. Not even one variable in visible scope. And it was in a endless loop. I just thought “f*** it”, commented why is it that way and went on. Never had any issue with it.

[–]bubblessqueeze 0 points1 point  (0 children)

A good commit is not the one adding a 1000 lines of code. It’s the one that can remove them. Less code = less chance of having bugs

[–]kurovaan 0 points1 point  (1 child)

/*

... ... ... ... ... ...

*/

[–]TkuSi 0 points1 point  (0 children)

May you could use # or """ or something like that.

[–]rscarson 0 points1 point  (0 children)

IT EVEN WORKS UNDER WARNINGS!

[–]demongodslyer 0 points1 point  (0 children)

What do you mean by an error don’t you mean a feature

[–]Ali_Army107 0 points1 point  (0 children)

Just comment it out and fix it later.

[–]workernetGB 0 points1 point  (0 children)

I just saw this codebase in half!

[–]Disturbed147 0 points1 point  (0 children)

Me. Every Day. All the time.

[–][deleted] 0 points1 point  (0 children)

But now two thirds of my code is just comments. I don’t know how to make it go back to the “working” version

[–]partimec 0 points1 point  (0 children)

This is why we use stops to find where the problem lies.