How do remember code better?
Posted by Medical-Wolverine289@reddit | learnprogramming | View on Reddit | 30 comments
So im learning python, everything is going great but there is some code that i cannot remember no matter how much i try. I can learn about *args and **kwargs and i wont remember what they do the next day, i dont really know how to avoid situations like this.
Error-7-0-7-@reddit
You're not supposed to memorize code. No one does. You're supposed to know how things work, maybe not the exact syntax
Conscious_Bank9484@reddit
I still look stuff up after more than 20 years of coding. It’s the stuff that you use repeatedly that you’re going to remember. You’re not in a bad place.
If you’re practicing for a class, then I guess you should keep reviewing till it’s off the top of your head. If you just code for your own stuff, then there’s no shame in looking stuff up as you go.
BranchLatter4294@reddit
There's nothing wrong with looking things up.
ameliawat@reddit
yeah same here. after a while the skill is more about knowing what to search for and recognizing good answers vs bad ones
DoomGoober@reddit
Exactly this. After coding for a while, you remember generally that a tool exists then you look it up.
As you program more, you look up fewer and fewer things but you never stop looking things up.
zezblit@reddit
I've been a software engineer for 10y now. I either remember it by happenstance or I google it
SourceScope@reddit
I forget things daily and google shit or look through old code
Feeling_Ad_2729@reddit
There are two different things people mean by "remembering code" and the answers are different:
Syntax / API details (exact method names, argument order, etc.) — don't try to memorize these. Every working developer looks these up constantly. What you want is to be fast at looking things up, not to never need to look. The goal is to know what exists so you know what to search for.
Concepts and patterns (how a loop works, what recursion is, how HTTP requests work) — these you should internalize, and the way to do that is to understand them, not to drill them. When you understand why a for loop is structured the way it is, you don't memorize it — you reconstruct it from first principles each time.
The practice that actually helps: build things that use the concept repeatedly until you stop thinking about the syntax. Write a dozen loops. Call a dozen APIs. After a while the syntax disappears from your active thinking and becomes muscle memory.
Also: using an editor with good autocomplete means syntax matters less anyway. Modern devs use their tools.
rustyseapants@reddit
How did you make it through high school?
How do you study?
This isn't a learning to program problem, this is how to study problem.
HOw to study coding
dinomacucule@reddit
You’re not supposed to remember everything after seeing it once or twice. Stuff like args and *kwargs only really sticks when you actually use them in real situations. Try building small projects and force yourself to use those concepts — even simple scripts help a lot. Also, instead of trying to memorize, focus on understanding what problem they solve. You can always look up syntax later, but understanding stays longer. Another thing that helps is repetition over time. Come back to the same concept after a day or two and use it again — that’s how it moves into long-term memory. Basically: don’t stress about forgetting. Even old folks Google things all the time LOL
spazure@reddit
It's one of those things that just becomes second nature the more you do it. No amount of memory tricks, games, or flash cards will be as useful as simply doing the thing.
az987654@reddit
keep coding
ThinConsideration864@reddit
Same, notes are a lifesaver for the stuff you dont use dailykeeps me from repeating lookups.
mrburnerboy2121@reddit
See this post: been coding for 8 years and I still google basic syntax daily
Old_County5271@reddit
This happens a lot, unless you have named parameters or your IDE spits out the API, you need to have the docs around.
Natural-Contact1997@reddit
you're not supposed to remember everything, if developers had to memorize all syntax, half the industry would collapse tomorrow.
seriously though, forgetting things like *args and kwargs* is normal, even experienced devs google basic stuff daily, the real skill is knowing what exists and when to use it, not storing every detail in your head. once you start building small projects, the patterns repeat and things stick naturally.
Medical_Mirror7834@reddit
First, anchor yourself to one language you already know well — say Java. Whenever you encounter a feature in another language, start by asking yourself how you'd do it in Java, then think about what's different. That contrast is what makes it stick.
And honestly, you don't really need to memorize the details at all. You just need to know that a feature exists. When you actually need it, just ask AI.
patrixxxx@reddit
Learn concepts and patterns (object oriented, functional, iteration, recursion etc) rather than verbs in any particular language
Calm-Reason718@reddit
I've been coding C for ten years. I still google how to define variables. Should lay off the ganja
Adventurous-Hunter98@reddit
Take a note of the things that you might forget or need to look it up again, no one is memorizing everything, just learn where to look for and what you need
ShardsOfSalt@reddit
Tbh just look it up. But for *args and **kwargs you can remember it by making associations. It might be helpful to remember these are variadic arguments. And look at how variadic arguments work in other languages to create extra associations in your brain. Usually a variadic argument is the last argument in the function because they "eat up" the left over arguments supplied to the function. In python's case *args is the last positional argument and **kwargs is the last keyword argument (and final argument).
Nevyn_Hira@reddit
Weirdly, printing it out and sticking it to the wall often helps me. It's right there if I need it but the fact that it's always there usually results in me no longer needing it.
Gnaxe@reddit
Try small experiments to demonstrate how they work, and then save the files for reference. Jupyter notebooks are great for this. You can also write explanations in Markdown. If you don't already have it installed, just use https://jupyter.org/try-jupyter/lab/. But remember to download your notes so you have a backup outside the browser.
Slottr@reddit
Use it or lose it - and if you lose it, google it. Its not a huge deal
Responsible-Elk-1939@reddit
Yeah I deal with same thing but with wiring diagrams and electrical codes for work - my brain just dumps the stuff I don't use regularly. I started keeping notes in my phone whenever I look something up so I'm not googling the same thing for third time in a week
Achereto@reddit
You can't avoid it. I've been programming since 1998 and I still look up documentation of code. There's just too much code to remember. The key is to write good documentation so it takes you less time to figure out how to use your code in the future.
I also experience atrophy every time I use IDE features. My IDE allows me to navigate code without using the file tree, which means that I eventually forget where certain files actually are. That's just the normal daily struggle. Instead of remembering specifics, you'll learn to be systematic in how you do things, so you'll find things where you expect to find them (without remembering it).
dyslechtchitect@reddit
Do this - Here's a little example 1. Write it from scratch then call it with arguements to see it print
Understand every line
Then ask yourself what args and kwargs are
johlae@reddit
Write these things down keep your notes close at hand. You'll remember, eventually.
Basic_Palpitation596@reddit
Solve the current problem instead of trying to remember arbitrary programming language features.
artur_pen@reddit
You can just remember functions and their order. Then it comes to it, you can just read them. Make sure to create short and catchy names. It lets you to come back to coding really fast