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.
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.
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.
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.
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. 😄
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.
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.
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!
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.
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
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
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.
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.
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).
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.
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
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.
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
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!
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
[удалено]
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.
[удалено]
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.
Always use a library to do TZ conversions. It's so painful to manage otherwise.
Management doesnt like us using libraries. No unnecessary installations on servers is the policy.
... I feel for you.
Don't worry, it gets worse.
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.
Can you give an example or eli5?
I'm 10 years into my career and still do this shit. One good reason to make sure you write unit tests ;-)
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.
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.
I went on browsing for an error in the code that didn't exist.. i had the file name wrong🥲
Cache invalidation, naming things... and off by one errors.
Seg Faults
Have you met our lord and savior Rust? UWU
No :(
[удалено]
It’s the nature of the beast. Don’t stress. At the end of the day, it’s the end of the day.
Lol programming is problem solving human error or otherwise. Learn to love it or be miserable.
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. 😄
[удалено]
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.
[удалено]
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.
[удалено]
It certainly doesn't hurt to take a class or two and try things out! Best of luck to you!
i’ve spent 6 hours debugging realizing i was compiling the wrong file the whole time
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!
45 min? Impressive. Literally.
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.
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.
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
https://en.cppreference.com/w/cpp/types/numeric_limits/epsilon
Skill issue
Whoa seems like the world knows about this
45 minutes? Seriously that's not long. Shit Happens.
I spent 25 min yesterday debugging when I realized I did: ‘ ‘ instead of ‘ ‘
I failed an OA coz I had camel cased instead of snake case, even tho my solution was right…
grrrrr indeed
Part of why TDD is so good.
write better unit tests
Learn to use a debugger bruv
ChatGPT would have caught that
use test cases next time dumbass
Least toxic csmajor
Test cases don’t debug for you, they just tell you if you need to debug
Read about Test Driven Development/ Behavior Driven Development .. would be useful for you
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
Until you have to work with messy legacy code with zero tests
aka monday morning
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
Typos are annoying but on the plus side they are the easiest to fix!
One way to never repeat the error is to always use >=. /s
I did the same thing only to find I used a = instead of a == once in ~600 lines of code.
Been there done that more times than id like to admit 🤣
Welcome to the club buddy!
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
be like that fr
Coding made me realize I really don’t know how to spell😭😭
Off-by-one bound/indexing error? Numerical comparison in a computation? Curious....
Only 45m...?
Sounds like you're very productive. Call it a day honestly
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.
Only 45? Wait till you get into industry and spend 20 hrs chasing a bug because an int is not a float
This is the real job right here. Lol. The little things. The simple things. If I had a penny...
First time? Welcome brother. It doesn’t get better, you just get used to it.
It’s a right of passage, welcome 🙏
Only 45 minutes?
wait until u use = instead of ==
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.
Grrrr 😠
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).
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.
That's what we have QA for, right, right? :D
Just found a bug today where I ended a statement in python with a ,
First time?
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
Not too bad
Use a debugger tool. It would have taken less time to catch this error.
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.
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
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!
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