Using mnemonics to write software 'in my head'

I love being a Software Engineer but I hate the physical effects of sitting in front of a computer for extended periods. I’m interested in the idea of using mnemonics to memorize code and therefore be able to memorize the source code that i’m modifying, then walk away from the computer and then edit the memory palace i’ve created and then return to the computer and just dump those edits into the machine all in one go.

Is this a realistically attainable goal? Is it much more challenging to actively modify a memory palace than to simply create one from pre-existing information? I have very little experience with mnemonics beyond reading most of Moonwalking with Einstein and trying out a couple of memory palace examples that the book walks you through.

I’d love to be able to write code in my head while I go for a walk instead of being so sedentary. Also I imagine this would solve the problem of looking at my own code months later and it seeming like someone else wrote it.


I have done things like this with paper. I suppose this is the old way. First some kind of diagram of inputs, algorithms, etc., then the code, still in paper. Even debug as much as possible before sitting in front of the computer going through the process in different scenarios. In my little experience, this produces a much cleaner code than to rush to begin typing without having the complete thing ready, but you need to know perfectly the language, the objects, etc.

I am sure I would NOT be able to do this for something complex without the help of paper and write the value of the variables in each moment, etc.


I feel as though I don’t really comprehend the physical effects of sitting in front of a computer for extended periods since I have done this for approximately half my life now. I have had periods of 48 hours straight in-front of a computer pretty much.

It’s doable but difficult.

Yes it should be, unless that memory palace is empty.

The way I do it is actually just by visualizing a terminal window being typed into. Somehow this sticks really well with me but it is still prone to being forgotten just less than hoping it sticks when you look away.

What you are trying to do is still very much doable, perhaps much simpler if you restrict your syntax and make a peg list for the syntax you will use. If you have an image for every piece of syntax you are planning to use it becomes as easy as just placing objects and walking through the memory palace. You might even find you prefer doing this with the algorithm over the syntax.

1 Like

It’s an interesting idea. What kind of programming do you do?

Awesome! I love this! I’ve been working on this myself for awhile (web apps with rails) and I strongly suggest you try to replicate some of the memory journey s you’ve done with Moonwalking but with some pieces of code. Start to convert the code snippets you already use in simple images and placing them in your palace, just Play around with the idea… Because there are so many dimensions to any given software, meaning a lot of experimenting will be needed to find what works. Those are my thoughts for now oh and also… For the moment I’m focusing on making journey’s that cover my git commits, branches, etc. we’ll see afterwards.

To edit ones code taking a walk! I can confirm this is possible with memory palaces, just start very small, and place your code in seperate journey’s, use the principal of repos and branches and don’t worry about not having enough palaces, we all have more than enough.
Thank you sharing can’t Wait to see what you come up with!


When you mention using different journeys and not having enough palaces, do you mean that you re-use memory palaces but have different objects on it? kind of like having the same text file but having different contents on different branches?

No, I meant to say that you don’t need to worry about not having enough palaces because you can always create new ones. I said that because , just starting out, it’s easy to worry that you will run out of familiar places to convert in palaces, journey’s. At least I did, and it cost me months on focusing on creating empty journey’s when I should’ve been developing the skill of translating what I wanted to remember in memorable enough images and placing these in an effective enough way in a palace.
On the contrary, I almost never reuse one(unless it’s very old and almost entirely forgotten).

:bear: with me. Regarding branches, I meant I use the same git branches and of course git commits Used in development as a model.
Example. When adding a new feature, I start a new git branch, but in my memory palace, instead of adding my new feature right then and there, I usually place a " porthole " to another palace, and when I am finished adding the new feature, I place another porthole at the end of this journey that brings me back to my master branch or to a new branch of this branch, etc.
As you can imagine, I do the same on a smaller scale for simple commits throughout. Makes it easy because I’m already used to this development workflow using git.

Basically, anytime I diverge from the main project, I jump to another familiar place. I have hundreds in use and I got accustomed to finding new ones. Sometimes by going to the first place that comes to mind when creating a commit or diverging to a new branch. Example:
git commit -m “Added view component for skills, progress bar” ::::
first image that comes to mind : A skying candy bar.
First familiar place that comes to mind: corner store where I used to buy my candy when I was a kid.
I then firmly place my skying giant candy bar in snow where I am at the moment, in my hospital cafeteria already full of code, and it reminds me to go to my candy store where I am building my view component for skills with progress bar…

Mmmm hope it’s clearer. Don’t hesitate to ask for precision.

Don’t hesitate to try to start a journey and try this yourself. There’s a lot of trial and error at first just discovering and development of skills needed for memory techniques such as this.

And I wish someone wouldve repeated the following to me when starting out : start small

Also Important::: have fun without stress. Do mess up, make mistakes, learn to enjoy making mistakes, and next thing you know, you’ll be creating these left and right with ease . These are the skills that helped me more than I could’ve imagined.


I write code in my head while I hike or walk. Sometimes I work out testing or debugging strategies too. If I’m bored by what you are saying, I’ll with my code in my head. It varies among individuals but I think it’s very achievable.

If you are fresh with the material and actively engaged then you probably don’t need a lot of support from your memory to make your work ‘portable’. The memory palaces I use are based on the code structure or the design structure. I just need an outline to keep things from getting jumbled around but once I’m reminded of the module/section/palace chamber/ I’m pretty familiar with what’s going on and the details all appear. Sometimes it’s objects, sometimes functions, a server, whatever description is most useful. I already have most of this in my head from thinking about the code, I just need to tighten it up.

Pick out the tricky bits, that SQL query where you can’t remember the exact syntax and jot them down in a small notepad. You probably don’t need many of those and just focusing on them to write them down will do quite a bit.

I have a very verbal brain so I can hear the code spoken as I think about it. Images are important but they are auxiliary, not the main framework for me. If you are very visual you might diagram the code and color it.

Here is a contrary suggestion: Give your poor brain a break! Forget about the code!. You might find you are actually more productive in the long run if you don’t hammer at it without letup - something we developers are prone to.


It’s useful to have some standard containers and some conventions. For me a chest of drawers always has 5 drawers in it. It can be made of wood or diamonds , big or small, ornate or plain, - “chest 'o drawers” is a stack of 5. In Javascript, prototypes are always alligators. Plain objects are made of stone or brick. If it’s text there’s a piece of paper…