How Meditation Can Make You A Better Programmer

How meditation can help you program better.

Programming is very much about flow, focus and keeping a context in your head. Your context includes what you are currently working on –  the location of code, the location of files, the structure of code, any programs that you have open and their contexts, and so on. It’s a lot for the human brain to manage.  Programmers’ livelihoods depend on the ability to focus and keep a coherent context in their head. Context is like a blueprint for what is currently on the screen and in the programmer’s mind regarding the state of the programming environment and past or future actions that act on that environment.

When a thought pops into your mental context, you can choose whether or not to let that thought permeate your mind and interrupt your flow, destroying your fragile programming context  – which in theory is just a configuration of neurons firing in sync.  Lets say your random thought is about a television show-  your brain could go on a tangent thinking about that television show. Maybe you’d think about a character on the show, or a certain scene or joke. When you resume programming again, depending on your level of focus and strength of context(how fast or powerful those neurons were firing) your context will be some degree weaker. Note this can all happen in a matter of milliseconds. It’s possible to take slightly longer to remember where certain code or files are in relation to your project after the context switch. It’s even possible forget what you were working on completely. Has this ever happend to you after an interruption? Studies freely accessible on the internet have shown that it can take up to 1 hour to rebuild your context and get back into the mental state of ‘flow’.

Meditation teaches you how to block out  unnecessary thoughts. You can just will them away, preserving your fragile context. After practicing meditation for a few days, you may start seeing that it’s easier to preserve and strengthen your context in spite of internal and external distractions(people, music, noise outside).