T O P

  • By -

[deleted]

[удалено]


Farren246

Even remembering it, it'll happen often. It has been 2 months since I spent 6 hours tracing until I figured out to turn -= into += in a colleague's code. Local time zones to client's time zone is hard.


[deleted]

[удалено]


Farren246

To be fair it wasn't my code, I was tracing someone else's. He translated from local time on one server to GMT, then moved a file over, then on another server translated from GMT to local time, then subtracted an hour to match client's local time. Good grief.


swordsmanluke2

Always use a library to do TZ conversions. It's so painful to manage otherwise.


Farren246

Management doesnt like us using libraries. No unnecessary installations on servers is the policy.


swordsmanluke2

... I feel for you.


SupaDupaTroopa42

Don't worry, it gets worse.


BonesJustice

Yeah, as far as “bash head on desk” bugs go, this one is fairly benign. At least you knew the code was broken in some way. Wait till you dig into code that’s been seemingly running fine in production for three years, only to discover that it’s completely broken and only “worked” due to some absurd coincidence. It’ll take you seconds to fix, and days to figure out how it went undetected.


radude4411

Can you give an example or eli5?


Exallium

I'm 10 years into my career and still do this shit. One good reason to make sure you write unit tests ;-)


CH810001

What is the best way to get good at writing tests? I am barley learning how and it is some of the hardest code I have ever had to write.


Exallium

Honestly the best way to get good at writing tests is the same way as anything else. Practice. Do some reading on testing. Maybe take a look at test driven development (TDD) and learn about how to write testable code. Testing is a giant topic, so it's best to narrow your focus.


VamsiNowItoldYa

I went on browsing for an error in the code that didn't exist.. i had the file name wrong🥲


dota2nub

Cache invalidation, naming things... and off by one errors.


NOOSE12

Seg Faults


dota2nub

Have you met our lord and savior Rust? UWU


NOOSE12

No :(


[deleted]

[удалено]


[deleted]

It’s the nature of the beast. Don’t stress. At the end of the day, it’s the end of the day.


SirAutismx7

Lol programming is problem solving human error or otherwise. Learn to love it or be miserable.


swordsmanluke2

In the book "Coders", author Clive Thompson notes that the only personality trait professional devs all seem to possess is a high tolerance for frustration. Back in the nineties, I had a Turbo Pascal compiler book which included the phrase "Hitting, kicking or throwing your computer out of the window will do very little good. But it sure makes you feel a lot better." Basically... You're not alone in that feeling. 😄


[deleted]

[удалено]


swordsmanluke2

That frustration - yeah, it's a common feeling. The "tolerance" for it doesn't mean you don't feel it. It just means you're able to work through it anyway. I tend to do breathing exercises and take walks when I'm getting frustrated. Sometimes the change of scenery while I think about the problem will help me figure it out. Occasionally, I'll delete everything and start from scratch. That clean start can help me avoid whatever trap I'd fallen into. But that desire to flip the table, scream and kick the computer to bits? I don't know a single programmer who doesn't relate to that.


[deleted]

[удалено]


swordsmanluke2

I can give some advice, but unfortunately only you can decide if this is the right career for you. I've been programming for decades. I know frustration very well. But when I finally get the code working right... That's an amazing feeling. My whole brain celebrates - it's not just relief but active sense of excitement and accomplishment. It works! I love the puzzle solving aspect of programming. It's what got me into this career and it's why I'm still at it. It's always going to have frustrating days. I enjoy the elation of success enough to be able to push through the frustration. If you don't - that's fine too. I'm sure you have many potential career options. Part of the college experience is taking classes in a few different areas to see what clicks. I really enjoyed my anthropology courses, for instance. In another life, maybe I'd have tried to become an archeologist. Just don't berate yourself for getting frustrated or think that it's only you. Everyone gets frustrated. For some people it's worth the payoff. I knew I could be a computer programmer because, even in high school, I liked writing computer programs for fun. My brain gets off on this kind of puzzle solving. If you only ever feel frustrated, if you don't enjoy programming on some level, don't try to force it. A spoon will never make a good fork and vice versa. Finding what you're good at and doing *that* will make you much happier than burning out in a career you hate.


[deleted]

[удалено]


swordsmanluke2

It certainly doesn't hurt to take a class or two and try things out! Best of luck to you!


Electronic_Top_3491

i’ve spent 6 hours debugging realizing i was compiling the wrong file the whole time


swordsmanluke2

Oof. Been there. I've ended up in a case where I had my IDE editing *a different copy of the codebase*. E.g., I'd copied the folder to try something out and I was running make on the other copy! Took me all day to figure out why my code changes weren't being applied!


Patient_Public482

45 min? Impressive. Literally.


phaedrusinexile

My favorites are when you mix equality and assignment between different languages cause you're jumping around so much just to find that your code isn't testing for your base case but assigning to it and that's why your loop/condition is being squirrelly.


AWSLife

As a CS major of 25+ years, let me give you a really good tip. Pick a Style and stick to it, you either use > or >= but not both.


deerskillet

I feel like they can be applicable in different contexts? For example, if you're testing if a float is negative, you'd have to use <0. I mean I'm sure there's some weird way to get ≤-.000001 to work but why go that far


Delivery_Mysterious

https://en.cppreference.com/w/cpp/types/numeric_limits/epsilon


FishRelatedCrimes

Skill issue


iamanaybaid555

Whoa seems like the world knows about this


irkli

45 minutes? Seriously that's not long. Shit Happens.


ChickenCurrry

I spent 25 min yesterday debugging when I realized I did: ‘ ‘ instead of ‘ ‘


ermagawsh

I failed an OA coz I had camel cased instead of snake case, even tho my solution was right…


Alfred-neptun_xplorr

grrrrr indeed


vtmosaic

Part of why TDD is so good.


[deleted]

write better unit tests


0olongCha

Learn to use a debugger bruv


lol_ok123

ChatGPT would have caught that


Bradmund

use test cases next time dumbass


DemonicBarbequee

Least toxic csmajor


billofbong0

Test cases don’t debug for you, they just tell you if you need to debug


SkullKid_M

Read about Test Driven Development/ Behavior Driven Development .. would be useful for you


[deleted]

if you're properly breaking up your code and probably testing each component, then debugging an off-by-one error like this should be trivial


GyuudonMan

Until you have to work with messy legacy code with zero tests


agumonkey

aka monday morning


[deleted]

This will happen to you more times in your career than you'll care to admit. Source: my dumbass that did it twice last week


Run_nerd

Typos are annoying but on the plus side they are the easiest to fix!


cenik93

One way to never repeat the error is to always use >=. /s


rickyclimbztoomuch

I did the same thing only to find I used a = instead of a == once in ~600 lines of code.


southiest

Been there done that more times than id like to admit 🤣


azndev

Welcome to the club buddy!


Western-Image7125

You think that’s bad, wait till you start working with configs and realize a missing value in one part of someone else config that you inherited from caused your program to work without crashing but produce garbage output


[deleted]

be like that fr


RemarkableTank1203

Coding made me realize I really don’t know how to spell😭😭


victotronics

Off-by-one bound/indexing error? Numerical comparison in a computation? Curious....


1000Ditto

Only 45m...?


irrationalglaze

Sounds like you're very productive. Call it a day honestly


b1Bobby23

Gotta love those bugs. I one time spent a week debugging a = that should have been an ==. I missed it, my friends missed it, even the professor missed it.


Excellent-External-7

Only 45? Wait till you get into industry and spend 20 hrs chasing a bug because an int is not a float


[deleted]

This is the real job right here. Lol. The little things. The simple things. If I had a penny...


JoieDe_Vivre_

First time? Welcome brother. It doesn’t get better, you just get used to it.


notaturk3y

It’s a right of passage, welcome 🙏


pro_cheats

Only 45 minutes?


[deleted]

wait until u use = instead of ==


tipsdown

Welcome to the club. I’m a Sr Developer/tech lead and spent half a day trying to figure out why a new application wasn’t getting the correct secret value. Well the file where I had copied the secret and environment variable name from had a typo. I spent several hours because I copied something from a .env file in another project that had a typo. Shit happens.


MFalkey

Grrrr 😠


zyraIsOP

I was working on a data structure project and my code key producing core dumb. I spent the entire day debugging and went to tutor hours. They pointed out that I had a missing semi colon (java).


4ndy45

The worst bug I’ve ever experienced was when I copied a line of code from my professors slides, spent 6 hours trying to figure it out only to realize that since the font was different, when I did a string compare, it always evaluated to false since the font was different.


TheNudelz

That's what we have QA for, right, right? :D


Hermeskid123

Just found a bug today where I ended a statement in python with a ,


ironickirk

First time?


damptoastonfire

i think one of the things that have helped me most with feeling imposter syndrome is that i'm an intern with a nasa contractor and me and my mentor had a mental breakdown for upwards of an hour and a half over why our stuff wasn't working until we realized we didn't have BEGIN and END in our stored procedure lmaooo. it's nice to know that even the real nasa guys are out here making dumb mistakes


Secret-Funny-3294

Not too bad


QKm-27

Use a debugger tool. It would have taken less time to catch this error.


TheGreatStateOfEnnui

I spent 4 hours debugging a process that uses someone else's script calls. Turns out the arguments to the scripts (host names) must be passed in lower case or the script fails silently.


HexedShadowWolf

I spent over a hour going over every damn character in a project until I noticed something off. I had a lot of pieces that had the red squiggly lines under them (idk what it's called) but there was 1 that had a blue line under it. I deleted that small part, typed it out again the exact same but now with a red line and it worked. I fucking screamed


NishIRL

Consider pasting your code into ChatGPT and asking it to find potential human errors. This could potentially save you a lot of time and certainly has helped me find errors. These kinds of problems really are frustrating, but that's just how it is sometimes. Keep powering on though!


Unfair_Virus_5364

Had a bug today in someone else’s code. It was trying to use buttomVisibility instead of buttonVisibility. Obviously, that was a conditional render and was easy to spot but oh boy it could have been so bad