r/learnprogramming • • 25d ago

Topic How do you explain code when your memory just shuts down?

Always had zero memory for memorizing stuff since school, but now in college it’s killing my grades.

​Spent 9 hours prepping for a lab defense, broke down every line of code so I knew it cold. Walked in, prof asked a basic question, and my head instantly went empty. Froze, mumbled two words, failed. Might be ADHD, stress, or just a cooked brain.

​Anyone else with bad memory survive this? What’s your actual method to retain code without memorizing it like a robot?

15 Upvotes

34 comments sorted by

16

u/Tangential_Diversion 25d ago

Honest question: are you sure it's your memory that's the problem? It sounds like you might have severe anxiety with tests specifically. It was very common among my peers in college where they knew all the info, but would freeze in a test environment. The fact that you "knew it cold" but couldn't recall during the exam makes me suspect it's anxiety over memory.

The reason I bring it up is because anxiety is addressable, but it requires a different approach than a memory issue. You can't flashcard your way out of anxiety, y'know? FWIW a lot of those same peers went to therapy, and they now enjoy great careers in fields with grad school admissions tests and licensing exams.

3

u/Gethimer 24d ago

I think that could definitely be a big part of it, honestly. These issues have been going on for a really long time (since about 6th grade), but I'm not 100% sure. Anxiety is definitely piling on right now too, because I've fallen behind and accumulated some academic debt/backlogs. I'm genuinely terrified of failing and not passing my 2nd year at uni. As for seeing a therapist, the thought has crossed my mind, but to be honest, I'm just too scared/hesitant to actually go.

4

u/GobblerOfFire 25d ago

What helped me was building personal projects. I was absorbing nothing when it “meant nothing”. As in how can I actually use a for loop (tons of ways but basic example) you can count through a list, or using a nested loop you could build a grid. There are tons of things to build for fun that can help give a lot of understanding. I find Daniel Shiffman’s “Nature of Code” an extremely useful tool that helped me understand code a lot more clearly because of the given examples and video demonstrations

1

u/Gethimer 24d ago

Thanks for the advice

6

u/denerose 25d ago

You’ve got to actually understand what you wrote and be able to read your own code.

1

u/Gethimer 24d ago

I thought I did, honestly. When I was working on it, I clearly understood what each part did. But when the time comes to actually recall and explain everything, I just can't. At the defense, I spent 4 hours trying to remember, but my mind was just completely blank.

3

u/Quesadillamexicana77 25d ago

one thing that helps a lot with defenses is explaining it out loud like you're teaching a friend, not rereading the code. pick a function and say what goes in, what comes out and why each step is there, and if you get stuck that's exactly the part you don't understand yet. also write a 5 line summary of the whole flow in plain words, because when your head blanks during the defense you only need that outline to get going again, the details come back once you start talking. and yeah like the other commenter said, freezing on tests is often anxiety more than memory, so practicing with someone asking you random questions helps too.

1

u/Gethimer 24d ago

​yeah, gotta take it a step further next time. I thought I did enough of that, but apparently not quite appreciate the tip

3

u/HallowVessel 25d ago

Test anxiety is super, duper common. This isn't bad memory. It might be a good time to reach out to your advisor about any help with mental health stuff that your school may have to offer. You aren't cooked, you just need help. 

1

u/Gethimer 24d ago

Appreciate it, I'll definitely look into that and give it some thought

2

u/NobblyNobody 25d ago

sounds anxiety related tbh, Propanalol? , beta blocker, ask your GP. I take it before public speaking type events, helps a bit.

1

u/Gethimer 24d ago

Thanks for the heads up, I'll definitely ask my doctor about that

2

u/TheSkiGeek 25d ago

What is a “lab defense” in this context? What kind of questions are you being asked?

I can’t remember any time in either my undergrad or master’s programs that I was expected to “memorize [code] like a robot”. Maybe in, like, DSA classes where you might be expected to do something like writing out pseudocode for an algorithm. But not a common thing.

1

u/Gethimer 24d ago

​It's an Algorithms class (and another one in C#, though that one is not as hard). ​In short, first they ask about a random line of code, then about the meaning of names, functions, classes, variables, etc. Then general theory about the code topic, like "what is amortized cost?". After that, a couple of questions about another part of the code, and then questions like "what happens if you write this code differently?" or "what happens if you replace this with that?".

1

u/TheSkiGeek 24d ago

Are they asking you about your own code that you wrote for an assignment? Or expecting you to, like, memorize the code for an algorithm from a textbook and then drilling you about it?

The former is normal and, uh, I’m not sure why you wouldn’t know how your own code works? The latter would be extremely unusual in my experience.

1

u/Gethimer 24d ago

That’s the whole issue, l feel like I get it, but the moment they start grilling me on tiny details, my mind goes totally blank on what does what, yet other parts I remember instantly. I don't even know what's wrong with me

2

u/Random_182f2565 25d ago

If it's ADHD medication helps, how is your coordination?

2

u/Gethimer 24d ago

My coordination is totally fine, sometimes i accidentally drop or bump into something, but I think that happens to everyone

1

u/Random_182f2565 24d ago

ADHD don't have anything unique per se, it's the frequency and intensity that is different.

Like being attacked by the corners of furniture or door thresholds

2

u/AdDiligent1688 25d ago edited 24d ago

Yeah my method was to write code everyday as often as I could. I’d use multiple languages usually, my assignments would be in one, and I’d write in others for fun. Sometimes if I didn’t know how to do something in the language, I’d write it in the one I knew better, then translate to that language and google what I didn’t know syntax wise. If you practice it enough, you don’t need to memorize as much, you’re training your brain to think like that and it comes more natural.

I’d approach coding, almost as you would a free response science question, you could write down all relevant equations and facts you can remember, but at some point, you have to leave your artist mark and connect them in order to answer the question, even if you don’t know. Maybe you’re not always 100% correct, but you’re also not 100% wrong, you’re somewhere in the middle, but that is still a reasonable solution for that format.

Coding in school is similar, you have to allow yourself to create your solution even in the face of uncertainty. Many students get analysis paralysis freeze episodes by overthinking questions, treating their a little bit wrong solution as completely wrong, forbidding themselves from attempting, then they shutdown and give up entirely. I saw this all the time when I tutored in college amongst straight A students due to stress and the pressure of perfection. It’s silly to do, and they knew this, because not putting anything is the only full proof way to receive no points on a free response. So with coding, treat it like that, practice outside of class, form the natural flow, pause, use the unspoken courtesy of allowing yourself to think about the question being asked, ask more questions even, take your time, then trust yourself to see and create a reasonable solution.

1

u/Gethimer 24d ago

thanks for this, really good perspective, gonna try this approach and practice as much as I can with the time I have left before the next retake

2

u/Flame77ofc 25d ago

try Flashcards

1

u/Gethimer 24d ago

I'm afraid that’s gonna be pretty tough to do with a whole 300 lines of code. I already make a full PDF breakdown just to reread and understand everything, but still...

2

u/YoungAspie 25d ago

Switch to Rust. No more memory issues. Also, local memory is inefficient. Use memory in the cloud. /s

4

u/ExoticAmphibian328 25d ago

I've got a memory like a leaky bucket and the only thing that's ever worked is rebuilding the code from scratch without looking. Start with a blank file and make yourself wire it all up again using nothing but the compiler errors as breadcrumbs. You'll panic less when your brain goes blank mid-defense because your fingers remember the flow even when your conscious mind doesn't.

1

u/zaphodikus 25d ago

30 years on, and my brain is still a sieve. I write most stuff down, and the rest, I code code code code until it sticks. You can do this.

1

u/Gethimer 24d ago

Thanks, I hope so

2

u/just_testing_things 25d ago

Not sure if this would work for a lab defense but in a professional setting you can always say “I’m not sure off the top of my head. I’ll get back to you on that.” and no one will question it. If the meeting is about an architecture or technical review, prepare slides or a document ahead of time.

2

u/binarycow 25d ago

When your brain is fried, your brain is fried. Take a break.

Don't memorize, practice.

2

u/WarPenguin1 25d ago

I don't know what a lab defense is but it sounds like a code review. 

If you wrote the code you can add comments about the code. So write comments with enough information so even if you are stressed out you can at least read the comment.

2

u/karanpargal 25d ago

Practise being interrupted, not just explaining the code from top to bottom. Have a friend pick random lines and ask “Why this condition?” or “What happens with an empty input?” so you practise answering out of order. If you blank during the defense, try saying, “Let me trace a small example,” then walk through the variable values. That gives you something concrete to reason from.

2

u/az987654 25d ago

Because you're putting your energy toward memorizing syntax and not reading and understanding what you're coding and why you're doing it