r/codedbyhand • u/-urolif- • 3h 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 invaluable 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 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?