How programmers remember all that programming stuff

The words Oops a memory painted on a wall
Credit: istolethetv CC BY 2.0

Coding mnemonics, which help software developers remember everything from variable names to language syntax, can take many - sometimes odd - forms


Now that I’m middle aged, I’m finding that my memory, as expected, is starting to get worse. Luckily, in addition to my wife and kids, I have mnemonics to help me remember things. A mnemonic is any device that can help you retain information, by translating it into a form that’s simpler or easier to remember, like an acronym or a saying or even a song. Mnemonics have been proven to aid in memory and retention and I'm making increasing use of them. For example, I still do the knuckle-thing to remind me of how many days are in a given month.

Software developers, regardless of age, have lots to learn and remember. Even the best developers can forget things like special variable names, command meanings, and the finer points of language-specific syntax no matter how many times they use them. Not surprisingly, then, developers will often come up with their own unique methods to jog their memories and save having to look something up in documentation.

I recently looked around the web to see what kinds of mnemonics programmers are using to help them do their jobs. As you might expect, some are pretty straightforward while others are more, um, creative. Here’s a sampling of some approaches to programming mnemonics.


Software developers are pretty logical people so, not surprisingly, they often rely on logic-based mnemonics to remember things.

“\r\n or \n\r? ReturN - R before N” leigh_t

“/s -- Allows .* to Slurp up numerous lines

/m -- Allows ^ and $ to match in the Middle of the string” blakem

“.unshift - makes it bigger. Longer word than .shift

.shift - makes it smaller. Shorter word than .unshift” da02


Music and songs are always a great way to try and remember or learn things. Developers are also often musically inclined, so naturally some use song-based mnemonics.

“I have melodies for common code snippets. ‘public static void Main(string[] args)’, which is the default method signature for the main method in C#, is a hip-hop beat. SQL statements are always metal tunes. Javascript is usually indie pop.” MichaelAza


Advertisers love using slogans because they’re easy to remember and can become lodged in our brains, whether we like it or not. No reason, then, they couldn’t be co-opted for programming mnemonics.

“I never remember that . = class and # = id in CSS, so I use ‘say no to drugs’ to remember that ‘hash is not class’.” hill79

More creative approaches

Developers, of course, are nothing if not creative, which can lead them to come up with more off-the-wall mnemonics, such as…

“<sdmkun> tar -xzf merc.tgz what the f**k

<sdmkun> how the f**k do you people remember this s**t

<bucketmouse> just think with a german accent

<bucketmouse> XTRACT ZE FILES” anotherhue

“Well, one thing I used to forget a lot was to make sure I successfully opened a filehandle properly, cause it'd cause my code to die in a funny way, so I reminded myself to

open FH, "< blah.txt" or die "Can't open file: $!";

and I could never remember what the special variable was, until I came up with the thought that, when I cause I program to die like this, I'm taking it out with a bang. <rimshot here> “ brianarn

Finally, my all time favorite mnemonic has nothing to do with programming, but I wanted to share it here anyways. As a big fan of the TV show “Cheers” while growing up, whenever I hear the word “Albania,” I always land up singing Coach’s famous Albania mnemonic.

Do you have any mnemonics to help you when writing code? If so, please share with the rest of us!

ITWorld DealPost: The best in tech deals and discounts.