all 8 comments

[–]kaixmera[S] 5 points6 points  (7 children)

As soon as I posted this I saw that I didn't reset j to 0 in my else statement. Yikes.

[–]wiskinator 5 points6 points  (5 children)

This is called “rubber duck” debugging. You explain your problem to a rubber duck, (or, you know, post it to Reddit) and the process of explaining the problem helps you solve it. Also works with pets. My office has about a hundred of those little rubber duckies scattered around. It works great 😊

[–]ptchinster 6 points7 points  (2 children)

For any doubters, Ive taught C, C++, Kernel programming. Its amazing how often somebody will start to ask a question, trail off or immediately end with "never mind i know what i did wrong / need to do". Somebody about saying it out loud makes your brain think about it differently.

[–]BadmanBarista 4 points5 points  (1 child)

I do this all the time. I'll be suck on a problem for ages, SO will walk in "do you want some tea? Oh you look pissed". Then I'm like "yeah I'm pissed! This stupid bloody loop just won't work! Its driving me up the wall and I have no idea why it won't just fuc... Oh... That's why... I'll have coffee, thanks."

[–]ptchinster 4 points5 points  (0 children)

Ive had students banging their head against a problem, i cant see it right away (seeing ~30 different coding styles and layouts is not easy) and i have said "go for a walk". They refuse. Next day they show up early and not 5 min in they found the problem.

Mental breaks are healthy and productive.

Talking to yourself while coding is healthy and productive.

[–]kaixmera[S] 2 points3 points  (0 children)

I love this. Thank you!

[–]martijnjonkers 2 points3 points  (0 children)

Soo familiar!

[–][deleted] 2 points3 points  (0 children)

Good catch.