this post was submitted on 11 Jun 2024
136 points (83.0% liked)

Programming

17352 readers
322 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
 

Title before edit: I hate programming, why did i choose this field

TL;DR: Stupid mistake, made by hours waste.

Basically, I was extracting date from the SQL db, and it was not displaying. I tried everything, heck I even went to chatgpt, and copilot. Two and half hours of trying every single thing under the sun, you know what was the issue?

SELECT task, status, id FROM mainWorkSpace WHERE user_id = @user_id

I FUCKING FORGOT TO ADD 'date' TO THE DAMN QUERY. TWO AND HALF HOURS. I was like, "Ain't no way." as I scrolled up to the query and there it was, a slap in the face, and you know what was the fix?

SELECT task, status, date, id FROM mainWorkSpace WHERE user_id = @user_id

Moral of the story, don't become a programmer, become a professional cat herder instead.

(page 2) 50 comments
sorted by: hot top controversial new old
[–] [email protected] 7 points 5 months ago (1 children)

I do this, too. The only remedies I know are a walk or a colleague's fresh perspective.

[–] [email protected] 7 points 5 months ago (1 children)

For me rubber ducking a coworker solves a lot of these things instantly, but walking just gets me further entrenched in my own stupid ideas.

load more comments (1 replies)
[–] [email protected] 26 points 5 months ago (3 children)

The difference between experienced devs and non experienced devs is that we have hundreds of stories like that under our belt. Hundreds of "Ah I wasted all this time because of a typo", and now we know to check for it.

It never stops. And after a while, a dev will share this exact scenario and you'll look back and share the same bit to them.

[–] [email protected] 4 points 5 months ago (1 children)

I had that experience last week. I half blame the language though cause the way it works is you don't initialize a variable, first time you use it the language automatically makes the variable and default value is 0.

I had a variable countoot that I had a formula calculate. Then a simple if countoot > 0 do this else do that. The program kept doing that. I knew countoot should be 2. I manually did the formula ... The answer was two.

I did the same formula in 3 other programs and it worked correctly. I spent between 1.5 to 2 hours a day for like 3 days banging my head on the desk trying to figure out why it would work. Fourth day me and 2 other guys were trying to figure it out when I finally really looked closely. I realized the formula result was stored in ccountoot(notice 2 c) and the if statement was based on countoot(notice 1 c)...yeah I felt so stupid when correcting the typo fixed the problem.

load more comments (1 replies)
[–] [email protected] 4 points 5 months ago

Thanks for sharing your experience, who knew a frustrating post written by me would give me lessons which i am going to take to heart.

load more comments (1 replies)
[–] [email protected] 9 points 5 months ago (4 children)

Get yourself a debug rubber ducky mate, talk to it when you are troubleshooting might fire off a coupe more pathways to identify the problem sooner.

[–] [email protected] 2 points 5 months ago (1 children)

Long before the duck gained popularity – and I still can’t talk to a toy – I walk around and explain things to a phantom off in the corner of my mind, and I use bold hand gestures.

[–] [email protected] 1 points 5 months ago

Bruh, I do this all the time! Can't solve a problem? Get up and walk around the house while I explain the issue to imaginary people!

[–] [email protected] 5 points 5 months ago (1 children)

I would like mine blue with an army's helmet.

[–] [email protected] 6 points 5 months ago (1 children)

You can dress it up however you like.

Holiday duck

Professor Duck

Tech support duck

[–] [email protected] 3 points 5 months ago

Tech support duck looks like he's checking out some delicious bread crumb photography on that palmtop.

load more comments (2 replies)
[–] [email protected] 1 points 5 months ago (1 children)

When I have problems like this, I start to question whether I can program at all and whether I should perhaps change my profession. This often happens when I'm tired or overworked. I make stupid mistakes and assume that the cause of the problem is something complex.

[–] [email protected] 1 points 5 months ago

This often happens when I’m tired or overworked. Maybe it's because of this and the frustration of the situation that had me (idk the word) go angry and write this post.

[–] [email protected] 56 points 5 months ago (3 children)

The best advice I can give to new developers is "question your assumptions".

"But I set that variable" - did you?

"It should default to 0" - is it?

Remember - if things were working as you think they are then your code would be working.

[–] [email protected] 7 points 5 months ago

Thanks will keep in mind next time it happens

load more comments (2 replies)
[–] [email protected] 2 points 5 months ago

I'm a coder and I like my job. It just has to fit with you. You have to be zen and like fiddling around with stuff. How did you even learn to write all of that if you hate it so much?

There's a book called what color is your parachute you might like.

[–] [email protected] 5 points 5 months ago

One of the hardest issues to troubleshoot is a bad assumption. Be glad you only spent 2 hours on this.

[–] [email protected] 4 points 5 months ago (1 children)

Every bug is an opportunity to learn. Learn about the language, the code base or about yourself. Today you learned about yourself.

[–] [email protected] 2 points 5 months ago (1 children)

Agreed. Sorry for my post, it was written in frustration of the situation

[–] [email protected] 2 points 5 months ago

I thought I was in programming_humor ngl. We’ve all been there friend

load more comments
view more: ‹ prev next ›