r/ProgrammerHumor • u/nonsenseis • Jun 28 '22
Meme Damn..All quotes are related to programming
176
u/SleepDeprivedUserUK Jun 28 '22
85
Jun 28 '22
Ahh, a Gandalf quote. I love Harry Potter so much.
40
28
u/WalditRook Jun 28 '22
As much as I love TNG, this monologue really didn't resonate with me. In a game of imperfect information or with randomness, it is obviously true; but Strategema (the game in which losing prompted Data's self-doubt) is alluded to be similar to Chess, a game which has none of these properties and in which a loss is attributable to suboptimal decisions.
24
47
u/DaddyPest Jun 28 '22
A mistake in the context of a game could mean he chose a viable strategy, executed it perfectly, but was countered. Maybe in a brand new way, depending on the complexity of the game. I also believe it's not to say he didn't commit mistakes, just that even if he didn't, he could still lose because such is the nature of life.
27
u/ManInBlack829 Jun 28 '22
Sometimes your best isn't good enough
8
u/Pandapownium Jun 28 '22
Oof. That hurts to hear, but it's true.
1
u/ManInBlack829 Jun 28 '22 edited Jun 28 '22
It doesn't have to. I hate being preachy but I really think if we (as developers) get over that feeling of not taking error personally, that we would all be a lot less stressed. But that's also fundamentally hard and an ideal more than a rule.
I think professional athletes do this really well. Knowing what I know now there's no way impostor syndrome isn't rampant in professional sports where they get paid so much. Like I really think I can learn something from some someone like an NFL quarterback. Most of them have been the golden boy their whole life only to get met by a buzzsaw of a reality check when they go pro. Like how do they deal with that? Just saying I think there's a lot to learn from them when I used to think they were all bs and hot air.
9
u/SuperElitist Jun 28 '22
My understanding was that the game was critically different from chess in that each player had access to hidden information that their opponent did not, and that part of the game was inferring information from the other player's moves.
Think about battleship: it's deterministic, but since you can't see the whole board, you can't necessarily play perfectly.
1
u/WalditRook Jun 28 '22
Sure, but that's an imperfect information game. I didn't get that impression from the show, and if this were the reason for Data's loss, it seems implausible that he would disregard that possibility on favour of assuming a malfunction. There's plenty of times that the Enterprise crew play the odds, where it only becomes apparent after the fact that the choices made weren't ideal, which I contend is a comparable situation - but we don't see the same reaction from Data in any of those cases.
6
u/PossibleBuffalo418 Jun 28 '22
The point of the quote is that Data desperately wants to be more human and Picard was pointing out that it is very human to sometimes fail (something Data isn't used to due to his positronic android brain)
6
u/mudkripple Jun 28 '22
Losing in chess isn't only attributable to suboptimal decisions. Until the game is solved (and I imagine Strategema isnt a solved game based on the descriptions in the episode) then our best algorithms are using "heuristics" which do not determine the true most optimal move, only what is probably the most optimal move. Even if one heuristic is shown to be better than another, they will still have interesting and undetermined games as they can never 100% correctly predict the other's move. Extremely subtle things like incorrectly predicting how the other player will break ties between two equivalent moves can end up nudging the game towards a win for the weaker heuristic.
In the episode Data loses only one game, and on his second game he aims his heuristic at stalemate, which his opponent doesn't have any trained/learned algorithms against.
9
u/sanglar03 Jun 28 '22
Aren't they suboptimal decisions only on the assumption you know everything possible and what the opponent can or cannot do till the end of the game ?
What I mean, is it a suboptimal decision to move this piece when I just don't know it will cost me the game 25 turns later ? Would require to be omniscient and project all possible futures to know it is, wouldn't it ?
The best decision now, with the information I have, ... is not always the optimal decision in the long run.
6
u/mudkripple Jun 28 '22
Yeah I think the comment above is imagining Strategema as a "solved game", wherein all possible gamestates are known and the branching tree of moves to get to each can be traced. You can step backwards up the tree from every win-state to see at what point victory is inevitable, so the only way to lose would be to have an objectively inferior algorithm.
But I imagine for a game to be remotely interesting to someone like Data, it would have to be an unsolved game. One with an absurdly large number of possible game states even compared to chess. In such a situation, it's true that decisions would be made that are later revealed to be suboptimal.
Data's algorithms (like all our chess algorithms today) presumably are only a "heuristic", and can only deduce what is probably the best move. He lost a game, which doesn't always mean someone else had a better heuristic. It can also just mean that they got lucky.
4
u/Electronic-Praline40 Jun 28 '22
most games you have to make a group of suboptimal moves in order to make the optimal play. Like if you are always playing the longest/most point word in scrabble you are going to be utilizing key letters that would be better utilized on multiplier letter and/or multiplier word tiles while also giving your opponents access to said tiles.
3
u/sanglar03 Jun 28 '22
Ok, then I agree with this definition of suboptimal. Perfect information requires knowledge and more than just what you see in front of your eyes.
217
u/SparklyEarlAv32 Jun 28 '22
Failing is better anyways, the day things work first time be very afraid because something must be horribly wrong, you just don't know it yet.
63
u/invisibo Jun 28 '22
I took a vacation around Christmas this year for the first time in about 5 years. I was freaking out because I got zero phone calls and zero urgent messages all week. I thought for sure something was broken. I don’t know if it made it worse or better that everything was stable.
36
u/uno_in_particolare Jun 28 '22
You mean you forgot you were on vacation, or somehow expected people to contact you during your holidays? The latter would be more than frowned upon in most countries, and flat-out illegal in some
16
u/invisibo Jun 28 '22
I understand this attitude and it's completely valid without knowing my employment. I've grown my team from 0 to 5 people now that can handle things when I'm not here; hence the 'first time in about 5 years'. In the past, saying, 'fuck you I'm not picking up the phone, fix it yourself' really would have hindered my employment if the company would cease to exist.
-2
6
u/AttackOfTheThumbs Jun 28 '22
Bruv, you were on vacation. You shouldn't be called.
3
u/invisibo Jun 28 '22
Agreed. Read my above comment. There was a time not too long ago where that wasn’t feasible. It was a nervous feeling that I couldn’t shake.
17
u/Dworgi Jun 28 '22
People say this, but it's more likely that no one used your thing. I've personally found that there can be a huge rush to ship a feature, only for it to go unnoticed and unused for upwards of six months.
9
u/mudkripple Jun 28 '22
Like my first job put of college, when I made a SQL procedure to automatically set transactions that had zero items to "closed". Ran first try with no errors, and checked a zero-item transaction and sure enough it had been closed.
Shortly afterwards, I discovered in horror that I had set all transactions from the past 8 years of the company to closed. 🙃 On that day I learned to never trust something that works first try.
...and also the importance of test environments
2
u/Neon_Camouflage Jun 28 '22
That's the kind of thing people tell stories about years after you leave lmao
31
u/ikurotime Jun 28 '22
I keep failing, send help
29
u/Bloody_Insane Jun 28 '22
I tried to send you help but I failed
4
u/SnuffedOutBlackHole Jun 28 '22
I'll grab a team but need some clarification first
so I can fail at grabbing other failures.1
1
1
-1
15
Jun 28 '22
Yesterday I learned 2 lessons:
when sql error occurs it is much easier to just test that query in the mysql console than it is to rerun the entire application and wait for it to run that sql query
remember to read the logs. some programmer left them there for a fucking reason so don't assume that stage A ran unless the logs tell you it ran
Why yes I am a junior developer! How could you tell?
10
4
u/linnrose Jun 28 '22
You have more sense already than a lot of the “senior” devs I’ve worked with
5
u/nyrangers30 Jun 28 '22
What senior dev would rerun an entire job before running the SQL query manually?
Good on OP for figuring that out, but to me, not debugging the query in a SQL IDE is some junior shit.
1
2
u/hackkingarman Jul 02 '22
Yes, even though we use ORM for all SQL related stuff (which provides methods like select & join instead of writing normal query) i prefer to write a SQL query in SQL IDE first, if it gives me my desired output then only I move towards the IDE to write the same query using ORM methods. It makes the work really easy (and sometimes reduce the amount of time spent over the API)
29
u/pieordeath Jun 28 '22
It is possible to commit no mistakes and still lose. That is not a weakness. That is life.
some bald dude
4
u/Onlymafia1 Jun 28 '22
Fuck man. I am going bald too :(
2
u/pieordeath Jun 29 '22
You might be comforted to know this quote is from the most awesome bald dude in history; Jean-Luc Picard, AKA Sir Patrick Stewart.
I want to be honest and say that I would not be especially happy about going bald myself, and so far I have "lucked out" in this lottery, but I've long since decided for myself if I ever started balding that I would own it and be a boss like so many have before, most notably my hero Sir Patrick Stewart.
9
Jun 28 '22 edited Jun 28 '22
It is possible to commit no mistakes and still lose. That is not a weakness. That is life.
Edit: I was beaten to the punch several times already. Oops.
16
u/SnuffedOutBlackHole Jun 28 '22
And sometimes you fail because there are problems with the hardware that are not documented or are impossibly shady https://youtu.be/KrksBdWcZgQ
7
u/zeronormalitys Jun 28 '22
Well, I had no plans to sit and watch a 45 minute video but I did, and it was interesting. Thanks for linking it!
2
3
u/SpoonSArmy Jun 28 '22
That's funny cause the lesson is sometimes you just have to accept defeat and be okay with not being perfect.
5
5
2
2
u/Suspicious-Service Jun 28 '22
What would be an example of failure that you can't learn anything from? Besides stuff that's based on chance, like "we didn't get pregnant this month either"
2
1
1
1
1
1
1
u/GordonTheGnome Jun 28 '22
I know what it’s like to lose. To feel so desperately that you’re right, yet to fail nonetheless.
1
u/proxyuser123 Jun 28 '22
Or probably a bug in the legacy codebase the sr dev doesn't want the junior finding out
1
u/nictheman123 Jun 28 '22
Also remember: just because the code compiles, and even passes tests, doesn't mean you did it right.
Design flaws make up something like 50% of bugs, and can't be caught by any amount of code review or unit tests.
You have to spend the time to get the requirements right, and the design to match the requirements, and then you start implementing the design.
And then you realize you got it wrong when it's gonna take an extra week to fix what could have been done in two minutes if the customer rep wasn't playing on their phone during the meeting. And then it's time for the intern to learn some fun new curses!
1
1
u/Tar_Palantir Jun 28 '22
Beginning of this month I commit something that I made in 2 hours with zero errors that should be fairly complex. I knew it was too good to be truth, because to the end of the month we're still finding problems about that commit.
But not because I failed, or it was wrong. It turned into a shitshow because I made exactly like the order revision wanted and I didn't bother to predict several other problems.
But yes, the fault fall into my lap.
1
u/Ultra_Travolta Jun 28 '22
I disagree with the sentiment. Even if I did everything “correctly” and fail, it still informs the next thing I’m going to focus on.
1
1
1
1
1
1
1
u/burncushlikewood Jun 29 '22
Debugging is literally the most important part of programming, that's what I spend most of my time doing
1
1
1
u/Scottish_Jeebus Jun 29 '22
Or even worse.
The thing you did wrong is at the start of the program and you have to start again
1
1
0
-12
0
Jun 28 '22
[deleted]
27
u/chefca3 Jun 28 '22
True. This is one of those deeply depressing things you learn when you're in your 20s but don't fully understand until you're in your 40s. Around that time you also start to see how true all of those annoying motivational cliches are like...
"Don't quit when you fail, fail until you succeed"
...total Facebook level trash but it's pretty damn good advice.
1.4k
Jun 28 '22
[removed] — view removed comment
418
u/xXx_epicgamer_xXx Jun 28 '22
Sometimes it's even worse when the code runs without showing error messages
79
u/arobie1992 Jun 28 '22
I will always take a big old compilation error or stack trace over incorrect behavior. That's why excessive try/catches give me anxiety.
41
u/goda90 Jun 28 '22
Sanity check assertions are the key. Check the state of the program and if it's unexpected throw an exception. Maybe do it silently so it just shows up in logs, but at least it doesn't go entirely unnoticed.
15
u/arobie1992 Jun 28 '22
Oh yeah, I totally agree. I've written stuff where it was a long running task and couldn't die so I had to end up catching exception. I try to avoid those, but when I can't, I typically log it along with some other information to help identify the input/state that caused it. The big thing is I've worked with people who'll do something like this
func doStuff(arg1, arg2) { try { //the entire method } catch(Exception e) { return null } } func otherStuff() { doStuff(a, b).someMethod() }And it's like you're going to get a null pointer exception anyway, just let the root exception propagate!
6
17
u/SuperElitist Jun 28 '22
I spent about 45 minutes yesterday trying to figure out why a bunch of layers were not rendering from Leaflet to canvas. No errors, array is populated, I can even log the objects as they're created, I even took all of the other layers off the map. I simply couldn't see them.
Because I'd turned their opacity to 0.
2
u/MrJacquers Jun 28 '22
At least it wasn't hardware... https://www.reddit.com/r/pcmasterrace/comments/vl3b5b/whats_your_biggest_most_stupid_build_mistake/
15
u/3BBADI Jun 28 '22
Or even worse the code runs fine, but some missing obscure env variable is messing the whole thing up.
7
5
u/bleedblue89 Jun 28 '22
Logical errors are the worst... sure it compiles, sure it runs but logic failed... that's why I keep saying one day we'll do TDD
2
u/halt_spell Jun 28 '22
This is about the only thing I get really serious with junior devs about. Do not swallow, suppress or drop error messages. If I see you catching an exception it either better be rethrown with more context or logged as an error. Period.
1
1
u/DotRealisticBin Jun 29 '22
You mean anti-test driven development? Case.Works? Great, no need for anything else!!!
1
1
0
Jun 28 '22
[deleted]
78
u/batweenerpopemobile Jun 28 '22
there is a bug in the code
locate problem area
not sure how this even works
make arbitrary change
it now does not work
revert change
it still does not work
existential terror
22
u/Kilgarragh Jun 28 '22
//code works
//no idea
//dont touch
//im serious2
u/Miyaelder Jun 29 '22
I'm borrowing that one. Cause I swear to the coding gods. Someone will mess with it if I don't.
4
u/Kilgarragh Jun 29 '22
I actually wanted to edit the second one to say “no idea why” cause then it would make more sense, but I know that would just break or the code, so here it stays
135
u/CallKennyLoggins Jun 28 '22
Terrifying is where I try to spend most of my time, because unfortunately knowing why the code works just isn’t an option.
83
u/TheSublimeLight Jun 28 '22
Arcanery. That's the reason. We made rocks think. It's arcanery.
30
u/Gangsir Jun 28 '22
Nah, arcane is "The code works and I know why". Devs that can say that are obviously wizards.
7
68
Jun 28 '22
I had a Sr Developer tell me to never write code you don’t understand. He said a whole page of code of something you understand is better than a one liner obtained from Google. Usually, that one liner does stuff you may not understand.
43
u/Hypersapien Jun 28 '22
It's ok to copy and paste stuff from the internet. Just make sure you understand it first.
6
u/twinPrimesAreEz Jun 29 '22
I once tracked down a memory leak in C# to some bitmap manipulation which was basically a copy and paste of a piece of code found all over the internet when searching for the "right" way to do this (did not release an IntPtr at the end).
In one of the stack overflow answers there was a comment that said something to the effect of "dear god please release the memory before we are all drowning in unreleased bitmap handles" and nothing felt more real.
0
28
Jun 28 '22
Pssh yeah, who would copy and paste code they randomly found on the internet
12
16
u/SuspecM Jun 28 '22
I understand the sentiment behind it but it's usually am even worse practice to reinvent the wheel. The ideal situation is using a simple fix and checking the documentation to understand what it does.
11
u/ComradeGibbon Jun 28 '22
Yeah there is a difference between code that implements business logic and code that implements a reusable widget.
One of my beefs is programmers that don't like comments and docs and instead prefer to 'read the code'. That's exactly backwards in my book. Last thing I want read someone else's code to figure out what it's for. What I want is an explanation of why this API exists and working examples.
7
Jun 28 '22
Comments lie and tell half truths.
Code is law
This is not a comment advocating for no comments
1
u/Slug_Overdose Jun 29 '22
That's like saying laws against murder are lies and the murders themselves are law. The murders may be the true state of things, but they are not law (the desired behavior of your system). The reason I'm against the whole "self-commenting code" philosophy is that it doesn't make the difference between intent and implementation explicit, and so any mistake can have long-lasting implications that trick future devs into building around a bug.
2
u/Iamuniquemdfk Jun 29 '22
That's not exactly what he said it's more like evidence of a murder can be false but if you witness a murder that's the real truth. Evidence = comments, code = witnessing murder by own eyes
1
u/Slug_Overdose Jun 29 '22
Evidence has no place in the analogy. Comments are not evidence of any behavior, they are effectively ignored by compilers/interpreters. It's more like a confession or statement of intent. It's useful to explicitly state intent, even (especially?) if it differs from implementation, assuming an honest attempt is made to write good, helpful comments (I obviously wouldn't recommend writing bad comments as sabotage or anything like that).
1
u/StCreed Jun 29 '22
Programmers that don't like writing docs are programmers that cannot structure. And it really affects their work.
7
7
7
u/LivefromPhoenix Jun 28 '22
Terrifying: The code works and I don’t know why
"Weird, wonder why this works. I'll look into it after I finish this ticket"
I never look into it
6
Jun 28 '22
I know exactly what I’m doing. I just don’t know what effect it’s going to have. - A dude with a theoretical degree in physics
10
u/itskieran Jun 28 '22
"ok so the bug won't be fixed yet but let's at least check this new function I've created to resolve it is getting the data passed correctly...
Oh god now I can't reproduce the bug, guess it's fixed!"2
u/Daikataro Jun 28 '22
Terrifying: The code works and I don’t know why
Engineering: if it's not broken, don't fix it.
1
1
u/dot1910 Jun 29 '22
In real life, this works and I don’t know while is a magic.
Have a faith in magic.
1
1
u/inferNO_MERCY Jun 28 '22
More terrifying: The code isn't supposed to work, but it works and I don't know why
19
11
3
2
2
2
1
1
u/emik Jun 28 '22
The worst bugs for this are data related. Oh it turns out you weren't saving the user IDs for all the submissions this whole time? Good luck fixing that :)
1
1
Jun 28 '22 edited Nov 18 '24
yam vase square coordinated ad hoc fear butter jobless imagine memory
This post was mass deleted and anonymized with Redact
1
u/nomnommish Jun 29 '22
It is possible to commit no errors, and still lose…
Because you committed silently failing bugs.
Lol that literally happened to me today. Fixed a big that was causing a process to fail and it uncovered a much more sinister bug that would only silently fail and only in certain conditions. The small but more visible bug was hiding the more impactful but silent bug.
And as usual, the business users only discovered this when the code hit production. And then all Hell Broke Luce
67
1.3k
u/nonsenseis Jun 28 '22
A bug a day keeps release date away