Can Mindfulness Improve Coding?

Can Mindfulness Improve Coding?


What is Mindfulness?

How to Meditate?

Why Meditate?

Can You Solve This Coding Problem?

Other Bits

What is Mindfulness?

Welcome to the latest news from TalkIT. This month we are going to consider how mindfulness can help coders. This follows on from the February 2013 newsletter where we looked at how to be a better programmer.Creative

These are just my ideas based on years of practice. As usual, I would really like to hear your ideas. Please add comments at the bottom of the blog.

Today mindfulness is available everywhere; there are classes, books and websites offering to teach this to you.

My wife is currently doing an eight-week introduction to mindfulness course. These courses are available all over the UK. Mindfulness practices, of course, have ancient roots including various Buddhist traditions. Buddhism provides a complete spiritual teaching, of which mindfulness is a central part. Here I am going to use the terms mindfulness and meditation interchangeably. Mindfulness is a more recent term, which can refer to meditation simply as technique without any associated spiritual teaching.

Research conclusively demonstrates the benefits of mindfulness. Practitioners experience improved spiritual and emotional well being. But mindfulness can also have some very practical applications. Here are some articles on how mindfulness can improve attention and concentration.

Programmers and IT professional can improve their personal effectiveness and productivity. Mindfulness can also help with problem solving, rapid learning and creative thinking. Overall, there are many reasons, why mindfulness improve coding and we observed it in this blog.

How to Meditate?

There are lots of techniques, but the basic principle is to focus your attention on a fixed object. This could be a sound, image or body sensation. Here is a simple, but not easy technique. This meditation uses the breath.

Find a place where you will not be disturbed

  1. Set the stop watch on your phone for 20 minutes
  2. Sit on a chair but keep your back straight
  3. Be comfortable but stay alert
  4. Close your eyes
  5. Become aware of your in and out breath
  6. Notice this wherever you feel it most; nostrils, chest, belly …
  7. Allow thoughts, feelings and sensation to arise naturally
  8. But avoid being lost in long trains of thought
  9. When distracted (you will be) return attention to your breath
  10. Be patient with yourself!

The aim is to make this a regular daily practice, to make mindfulness a good habit. But like any complex skill, this will take time and patience to learn. Here is an article on how to meditate.

Why Meditate?

You may well ask how noticing your breath can improve coding.Meditate

To start with, you are allowing yourself some time to solve problems. When your brain rests it naturally wants to provide solutions. Meditation allows the answers to come to you without making undue effort.

When you meditate your brain patterns change. Your brain waves slow from beta wave (13-25 CPS) to alpha (8-12 CPS). This recruits the creative and intuitive parts of your brain. In this state you can get deeper insight into the core principles of any system.

Also see the December 2014 newsletter where we looked at how to be more creative.

When attempting to fix a software problem, we often keep trying new things. If we are tired or stressed, this can be counterproductive. We can even destroy our own work! Learning to step back is very useful.

People often think meditating requires stopping all thoughts. I think it is more about distancing yourself from thoughts. The knack while meditating is to allow useful thoughts, but keep returning your attention to the breath. This keeps you focused and prevents pointless distractions. You can also try keeping a pen and some paper beside you while meditating. You can then write down your great ideas, when you stop, before you forget them.

Meditation does takes time to learn, so do not set your expectations to high.

 Can you solve this coding problem?

Let’s look at searching a sequence of numbers. We’ll demonstrate with a game. Guess any whole number between 0 and 63. Is it less than 32? Yes. Is it less than 16? And so on.Problems

The number can be found by asking only 6 questions.

Write a short elegant in any programming language to:


  1. Ask the user to select a whole number in a specific range
  2. Ask the user Yes or No questions to narrow the range
  3. Display the number selected.

Searching is a fundamental algorithm and a common function. But how do we do it? We could use the binary search algorithm. A binary search is used to quickly find a value in a sorted sequence. Each of the iterations will eliminate half of the remaining possibilities. This makes searches very efficient

You can then enhance your code to search for words rather than numbers. For example, put the sorted last names in a string array. Then return the index for a specific name.

Other Bits

TalkIT has again been very active on social media. We have been posting on coding, new gadgets and IT humour. Why don’t you connect with us on Twitter or FaceBook? You can follow all the latest news and join the discussion. Do you agree ,that mindfulness improve coding ?bits

Twitter                                            FaceBook

@NowTalkIT                        NowTalkIT


Here are some recent tweets.

A new online course in C++ has just been added to the TalkIT site. Also a Python will be added to in May. Take a look at the first a C++ tutorial.

 C++ tutorial

Python in May

In December we published a full Java courses. There is a launch offer of £4.99 per course monthly or £9.99 for Gold monthly subscription till end March.

 Thanks to PsyBlog for articles


David Ringsell MCPD 2015 ©



Scroll to Top
Share via
Copy link