r/codedbyhand • u/-urolif- • 18d ago
How do you approach memorizing a programming language?
I like to have everything in a language I learn memorized in my head so that I can use it without any external information. I also do all my coding in Vim without any intellisense style autocomplete, just syntax highlighting. For some languages like C++ this is probably nearly impossible, but that's part of why I favor small languages like C.
One tool that is helpful is 'spaced repetition'. Traditionally this was done with a Leitner box, a card box having differently sized compartments allowing you to schedule review of only the flashcards which you have difficulty remembering, but there are many programs out there to assist with this kind of study such as Anki.
The other thing I think is invaluable is simply writing very small programs. It's impossible to learn programming by only reading books, guides or watching videos. You can only learn all the little quirks of syntax by typing things out and making mistakes. When I learn a language I find an exhaustive book, and for each new language feature introduced, I write a tiny program demonstrating only that language feature from memory. This also forces you to write the basic boilerplate of your language over and over, so that you always have it at your fingertips.
Another thing that I think helps is writing very long descriptive variable and function names.
char str[] = "im_talking_whole_sentences_as_names";
This helps me to remember what the different variables and functions in my program do without comments, and helps me with comprehension generally, which helps with memorization as the information is integrated. It does make for a lot of typing, but I like typing, so I don't mind.
How do you approach learning programming information, and keeping everything straight in your head?
12
u/Low_Lawyer_5684 18d ago
Memorize by using. This is how it works. C++ can be better understood and memorized if you have experience with C
6
u/SteveMacAwesome 18d ago
I keep markdown docs of gotchas or “oh handy” moments. Periodically I read them but mostly it’s down to just using it a lot.
5
u/Rare-Improvement6171 18d ago
My approach is basically to “play” with the language and let my curiosity drive my learning. While coding I get curious if there are different ways to do what I just did, or libraries to make it easier or better in some way. I find studying doesn’t leave as long of an impression in my brain as discovery.
For this reason my projects always have a set of “unit tests” which are really just me trying out different functions before I choose which one to go with!
5
u/YuanHao 15d ago
After programming for more than 10,000 hours you will be surprised how little you need the internet.
BTW typing everything without intellisense is amazing for this. I did it when I learned Javascript/React in my 30s and in one year I was the best and fastest programmer in the company.
Oh, the world before AI
3
u/LutimoDancer3459 18d ago
Use it. Repeat it.
3
u/AcanthopterygiiIll81 16d ago
Honestly I basically just prioritize practice over anything. The more I use something, I memorize it better naturally.
2
u/zerg_1111 18d ago
I rely on the auto-complete provided by IDE since there is just too much to remember. I am an Android developer. Everything in the echo system changes rapidly and the old APIs get deprecated pretty fast.
2
u/raizensoft 17d ago
Just doing a lot of projects that strengthen your muscle memory. I hand coded over 200 games over the years with Java, neovim, a library (libGDX) and online docs, which also help me build a complete mental model of the API in my head.
2
u/FlatStruggle3911 17d ago
"Concepts of programming languages" is a good book, not for memorizing the languages but understanding what they do under the hood.
Regarding memorizing syntax and standard library. Don't, just integrate the manuals to your vim. So that you can lookup whenever you need to.
Regarding C++, the language became ridiculously huge with latest versions, I am not aware of anyone using its full set of features. The trend I see is that, usually they take subset of the features they think are useful, ignore the rest.
2
u/FabulousAd5399 15d ago
vim with only syntax highligting is a good approach
2
u/thussy-obliterator 9d ago
most languages are actually fairly simple, and you learn by doing. and you'll maybe only need the complex stuff once every ten thousand lines. yeah, python HAS recursive generators, ain't used 'em once since college, but honestly i don't think i'll ever forget em.
1
u/YouPeopleCantBeReal4 15d ago
I don’t memorize, would be a waste of my time lol. I use docstrings a lot, and when I know what I want to do but don’t know if the language has a feature for it, I look it up
1
u/ProgrammingChaos 13d ago
For a language that is relatively new, start with a program that works and look for ways to modify and expand it. Especially in ways that force you to use the concepts you're trying to learn/memorize. And for a lot of people, writing notes by hand helps a lot. There's something about composing the note in your head and physically writing it out that helps a lot with memorization.
1
u/Lucky_Cable_3145 10d ago
30 years ago I memorized much of the WIN32 API / MFC, I haven't coded with it in 20 years...
I advise you learn how to use the tools available in a coding language, you can search the params of printf() in the language you are coding when you need it.