Mnemonics for Programming Languages

Does remembering lines of code make you queasy?
Do you often resort to copying parts of code from other parts of your program, or the internet, because you’re too lazy to remember the exact lines of code to write?

Well, fear not!

Introducing… Programming Mnemonics for dummies!
This will make all those asterisks, percent signs, and commas commonly found in code easier to remember!
Here is a personal list that I came up with:

  • bow and arrow
    _ floor
    ( california
    ) china
    [ metal california
    ] metal china
    . eyeball
    : colon
    ; vagina
    ’ sperm
    " testicals
    / japan
    \ florida

blue bird
< pink bird
| twig
? pikachu

  • star
  • medical kit
    ` hair
    ~ ocean wave
    ! cat tail
    @ ear


$ dollar bill
% scale
^ carrot
& pretzel

If you have better suggestions or otherwise, please let me know!


Good idea, thanks :slight_smile: But in terms of copying your code from other parts of the program - this is why we have functions :stuck_out_tongue:

1 Like

This will definately stick in my mind forever.

Can you explain the California and China as well as the metal California and metal China?

Also is it efficient to memorize using a system like this?
Lets say you are working in c++, you already know at the end of almost every line there needs to be a semi-colon.

I’m thinking that memorizing code would be a lengthy, tedious process but I have never tried it.

I think it would be better to use mnemonics to memorize library function names, algorithms, or pseudocodes, since you shouldn’t rely on memory when writing some function. Memorizing verbatim will only make you a weaker programmer. You should always rely on your own logic and your program should be unique. Everyone has his own programming style. Also, googling stuff is always useful. You might find new ways of doing things that you’ve never thought of before. Maybe, if you want, you could do mnemonics to memorize design patterns(Strategy Pattern, Observer Pattern, etc…) since that’s useful.

1 Like

i think people should keep a mental list of the most common
problems people make when writing a program.
then check each line/varible/file name/loop in the program against the mental list.
i got a lecture at the start of the year in python
for three years in a row on the most common mistakes people make.
i still after three years make those mistakes in every single program i write no matter how small.
even if it’s a single line!
but the average number of mistakes i make seems to have decreased
and i seem to be able to notice and correct these mistakes much faster,
then when i started the course.

some of the usual mistakes are:

1:spelling mistakes or spelling something differently.
e.g. friends=5 instead of friend=5.

2:or using or missing capital letters.
e.g. ninja instead of Ninja.

3:wrong syntax
e.g. forgetting to use two ==
if count = 0: this is meant to be if count == 0:

or leaving out the colon after the 0
e.g. if count == 0
or most importantly leaving out a bracket

print (‘Hello World’
instead of
print (Hello World)

4:wrong indentation
e.g. for letter in ‘hello world’:
print letter
print letter should be tabbed in.

i could have had a mental list of these problems but i was too lazy.
and by now i seem to know most of them.
like leaving a space in the name of a varible or filename.
my file = ‘Hello’
instead of my_file = ‘’

this list would greatly decrease the time it takes to troubleshoot a program.
also it’s great for remembering syntax,builtin varibles or steps to using some part of the language.

like when you learn how to add or remove things to a list or dictionary.
you can put the steps and syntax in your memory palace.
or even around the room as you see the.
things like.
.startswith() or .endswith()
.split() or .strip()
or keywords etc.
from … import *

1 Like

This isn’t a mnemonic solution, but have you tried code linters? They can alert you about common code errors on every file save.

Examples: there is PyLint for Python and jslint (or jshint) for JavaScript.

I use Syntastic in Vim. There is also Pylinter for Sublime Text and various other plugins for other editors.

[2021 update: There are newer tools available now.]

I agree, the semicolons and common symbols will stick to your muscle memory anyway. Remembering all the code like that will slow you awfully down.

I have memorized java. I started with visualizing how classes (abstract classes, sub-and superclasses, interfaces) work, then continued with constructors, methods. It was especially helpful when java has come up with some illogical rule that you would always forget without the help of mnemotechniques.
Then I continued with specific classes and its method names and what they do (I want to at least be able to apprehend which class and its methods would be useful to solve the current problem, and this will help me to google it if I need it).

I have also memorized the key aspects of some code parts that I find interesting (for example how to make threads and how they work).

1 Like

A little crass, but it’s okay.

I don’t think symbol-verbatim memorization of computer code makes sense. What you should commit to memory instead are the fundamental parts and their mutual functional relations that make up a single recyclable module of your program, so that you can easily reconstruct it at will. Treating code as mere data kind of misses the point of programming (unless you’re writing macros in Lisp).


I actually search for this one. Very nice.

My personal not so mnemonic method is to memorize the core message from what I see and go with it then all those high tech editors will help me complete it. That way I have got to reconstruct again.

1 Like