V
25
c/coding-for-beginnersbaker.christopherbaker.christopher25d agoProlific Poster

Recursion finally clicked after seeing a stack trace at work

I fought with recursion for months, watching tutorials and rewriting the same fibonacci function over and over, but it never stuck until a senior dev showed me a real stack trace from our bug tracker and walked through each frame. That visual of the calls piling up and unwinding just made the whole concept obvious, has anyone else had a similar 'aha' moment from reading an error log instead of a textbook?
1 comments

Log in to join the discussion

Log In
1 Comment
the_robin
the_robin24d ago
...and here I was thinking I was just dumb because I kept drawing little arrows on paper trying to trace factorial(5). Turns out my brain needed to see the actual mess, like a stack trace in prod where one bad call spawns a million others. I remember staring at our error log and going “oh, THAT’S what unwinding means, it’s just the function giving up and walking backwards.” Now I can’t unsee it, but I still write recursive code and pray it doesn’t blow up, so maybe I’m only half cured.
8