Can Mindfulness Improve Coding?
What is Mindfulness?
How to Meditate?
Can You Solve This Coding Problem?
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.
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
- Set the stop watch on your phone for 20 minutes
- Sit on a chair but keep your back straight
- Be comfortable but stay alert
- Close your eyes
- Become aware of your in and out breath
- Notice this wherever you feel it most; nostrils, chest, belly …
- Allow thoughts, feelings and sensation to arise naturally
- But avoid being lost in long trains of thought
- When distracted (you will be) return attention to your breath
- 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.
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?
The number can be found by asking only 6 questions.
Write a short elegant in any programming language to:
- Ask the user to select a whole number in a specific range
- Ask the user Yes or No questions to narrow the range
- 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.
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 ?
Here are some recent tweets.
- Do not use vendor-supplied defauts for system #passwords and other #security parameters #infosec #awareness #root #admin #sysadmin
- Evolution of C. Which one do you use? #csharp and #cplusplus courses http://talk-it.biz/training/tutorials/ … #elearning #c #coding
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.
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 ©