V
25

Appreciation post: the 'rubber duck' method saved me 4 hours of headache last night

I was coding a simple login page for a project I'm learning from. Spent a solid 4 hours stuck on why my form validation kept crashing. I was about to throw my laptop out the window. Then I remembered some thread I saw about explaining your code out loud to a rubber duck. I grabbed a half empty water bottle from my desk and started talking through each line. On my third explanation I realized I was checking the input length before the variable even got defined. Felt like an absolute goof but it worked. Has anyone else had a stupid simple fix like this after talking it out loud to something?
3 comments

Log in to join the discussion

Log In
3 Comments
alice_allen5
You spent four hours on moving a line of code around? I would have lost my mind after twenty minutes!
4
morgan.jason
Man that's totally how debugging goes sometimes, you gotta wonder if the universe just messes with us on purpose lol. It's like building a lego set only to realize one brick was one stud off the whole time.
6
beth_park
beth_park5d ago
You know what's wild though @alice_allen5, sometimes that one line of code isn't even wrong technically, it's just in the wrong spot because of how the compiler reads things. I once spent a whole afternoon on a CSS bug where the fix was literally moving a closing bracket three lines up, no joke. It was like the code was haunted or something, just sitting there knowing it was fine but the browser disagreed.
7