How to use fundamental programming concepts to achieve your personal goals by sunjata

View this thread on steempeak.com
· @sunjata ·
How to use fundamental programming concepts to achieve your personal goals
What do you want to achieve - not this week, but in five years time? An understanding of the physics of black holes? Total physical fitness? Fluency in another language? Owning a whale-sized wallet of steem power? In this post, I'll show you how two powerful concepts from the world of computer programming - iteration and recursion - can help you achieve things that seem impossibly distant.

![Start mountaineering by finding a mountain that is waist-high](http://res.cloudinary.com/dlj1wzg5g/image/upload/c_scale,w_400/v1469666561/Noun_62811_-_Achieve.svg_wdr2vt.png)

Applying the ideas of iteration and recursion to the discipline of improving yourself is the best way to navigate the difficulties you will encounter along the way - and it will stop "this is hard" from turning into "I give up". If you struggle with impatience, iteration and recursion can help you. If you struggle with motivation and 'stick-to-it-iveness', iteration and recursion can help you. If you are geeky enough to need everything explained in computing metaphors then, yes, iteration and recursion can help you.

## Why I needed to discover iteration and recursion 

My Achilles' heel was impatience. For a long time, I struggled with two parts of myself that I assumed were in conflict:

1. I would develop a passion or interest in some subject or hobby and *luxuriate* in it. I wanted to know everything about it. Every damn thing.
2. But, in getting to know every damn thing about a subject, my ambitions vaulted higher and higher. I didn't just want to start doing yoga, I wanted to do a headstand. I didn't want to learn maths, I wanted to prove Fermat's Last Theorem.

And, of course, I found that *wanting* something impressive was a lot more seductive than *doing* the foundational work that would get me there. In other words, I didn't understand that becoming an expert was an *iterative* process. And so, inevitably, one passion would bubble along for a while until, unfulfilled, it was replaced by another.

## The evidence that another way works

I still have my impatient moments - days, even - but I don't have that mindset anymore. So, what changed?

First, I achieved something concrete that required the opposite of the "I-want-it-now" approach. I wrote a PhD thesis of nearly 100,000 words. There is only one way to write something like that: piece by piece, revision by revision, until it's done. Even if *I* was impatient, my work had to be patient and iterative: real fake-it-till-you-make-it stuff.

But achieving something big in small steps wasn't enough to change the way that I thought.

## Learning the iterative mindset  

My mindset changed only when I began a career in technology, and started using the ideas of iteration and recursion regularly. One of the things that I loved about doing data analysis programatically was that, once I built a fully-tested solution, it just worked - and it would continue to work unless some external force broke it. This meant that I could build a simple analysis on some dataset one week, a simple analysis on another dataset the next week, and then return a month later and create a complex analysis that combined both analyses and a *third* dataset. By doing simple things well, I could iterate my way towards something much more complex.

Gradually, I came to realise that this technique - iterating towards a goal by doing something simple and then storing the results - would also work for my personal goals. I call this idea the **iterative self**. You get to the place you want to be one step at a time, and each step depends on the steps that came before it. 

This is how the idea of *iterating* towards my goals worked for me:

- I became better at data science by learning one algorithm or statistical technique at a time; months later, I found myself able to combine them in unexpected ways because those tools were there, waiting for me. 
- I became calmer and more relaxed by meditating regularly; in moments of stress, I found I had reserves of stillness and awareness to draw on.
- I became fitter and stronger by doing one set of push-ups at a time; each time I returned to the exercise, I was a little stronger and could either hold my form better or perform more reps.

Individually, the things that I had done to improve myself were unspectacular. But, day after day, week after week, those incremental improvements began to add up. Iteration works because our bodies and brains adapt a little at a time, and the new strengths and skills that you learn get stored away without any extra effort. 

For those who are naturally patient, easily motivated and hard to discourage this may seem obvious, or even *easy*. But most people struggle to achieve their goals. The idea of iteration is a powerful way to stay on track, particularly when you start defining some 'algorithms' and seeing real results.

## Algorithms for the iterative and recursive self

Life is complicated and getting to where you want to be is hard. But the idea of the iterative and recursive self gives you the tools to break down goals that seem distant and unachievable into goals that are discrete, simple and close at hand. Reaching those simple goals repeatedly will, in time, get you to the complex goal that you really want to hit.

Let's see how that works with a single goal: "I want to do be able to a set of 10 push-ups with good form". This is a clear goal, with an obvious way to reduce it to an 'iterative' algorithm: we just keep doing push-ups until we hit the goal of 10 push-ups. If we reduced this down to pseudo-computer code, it would look something like this:

```
def do_push_ups():
  push ups ⇐ 0
  while push ups less than 10 and not exhausted:
    do a push up
    push ups ⇐ push ups + 1

  store strength for use next time
```

But, actually, the push-up is a pretty [demanding exercise](https://www.reddit.com/r/bodyweightfitness/wiki/exercises/pushup). We need strength in our arms and core to hold our body in a straight-line. We need strong and flexible ligaments in our wrists and elbows. We need the power in our chest and upper body to move our entire weight down and back up, smoothly, while holding the right form. Most people can probably force themselves off the ground and back down, but this isn't necessarily the same thing as a 'good form' push-up - and our algorithm for getting to *ten* good-form push-ups is more likely to lead to discouragement or injury than lasting strength. 

How can we do better? We can apply the other fundamental programming technique, **recursion**. In the simplest terms, a recursive function is a function that *calls itself*. Often the tactic of a recursive function is to break a larger problem into many similar sub-problems, solve these and then combine the answers. 

In effect, this is what we need to do to achieve the goal of ten good-form push-ups: we can work on strengthening the ligaments, tendons, the core and upper body by doing smaller versions of the final push-up movement. The ['push-up progression'](https://www.reddit.com/r/bodyweightfitness/wiki/exercises/pushup) gives us a clear guide on how to get to our goal, regardless of how strong we are when we start out. A recursive algorithm that guides us through the push-up progression towards good-form push-ups does two things:

- It says "if you are not strong enough to do full push-ups with good form", use this same algorithm to do the push-up progression for an easier variation with good form.
- It defines 'push-ups against a wall' as the easiest kind of push-up, and says "if you have dropped to this point in the progression, stop, and then do wall push-ups until you are strong enough to move on". 

In pseudo-code, this recursive algorithm would look something like this:       

```
def do_push_up_progression(push_up_type, num_reps):
  if push_up_type == "vertical":
    do_push_ups("vertical", num_reps)
    return strength
  else:
    if strong enough: 
      do_push_ups(push_up_type, num_reps)
      return strength
   else:
     do_push_up_progression("an_easier_push_up", num_reps)
```

The computer science concept of recursion rarely maps exactly onto the more diffuse goals that we have in life, but the metaphor of breaking larger problems into smaller ones is a helpful way to make your goals achievable. And, to keep you motivated, it makes sense to visualise the iterative tasks that you do as being part of a larger recursive pattern that fits your long-term goals and ambitions.

## Conclusion

Changing the way that you think and act is never easy, but holding onto the ideas of iteration and recursion is a great way to build habits that will help you achieve goals for the long-term. Your achievements probably won't be visible immediately and so - to reinforce that iterative mindset - using apps that track your goals and progress is a great idea. Strava for running and cycling, Duolingo for language learning, or [Seinfeldian chains](https://play.google.com/store/apps/details?id=org.isoron.uhabits&hl=en_GB) for any habit you want to keep - these are all great ways to convince yourself that your progress is real. And, in a year's time, you will surprise yourself by remembering how utterly confused you once were by something that is now obvious.
👍  , , ,
properties (23)
post_id303,755
authorsunjata
permlinkhow-to-use-fundamental-programming-concepts-to-achieve-your-personal-goals
categorymotivation
json_metadata"{"image": ["http://res.cloudinary.com/dlj1wzg5g/image/upload/c_scale,w_400/v1469666561/Noun_62811_-_Achieve.svg_wdr2vt.png"], "tags": ["motivation", "programming", "life", "lifelong-learning"]}"
created2016-07-28 00:55:24
last_update2016-07-28 00:55:24
depth0
children1
net_rshares2,050,993,006
last_payout2016-08-27 13:39:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length9,271
author_reputation2,215,927,542,723
root_title"How to use fundamental programming concepts to achieve your personal goals"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (4)
@itay ·
$0.03
I upvoted You
👍  
properties (23)
post_id731,200
authoritay
permlinkre-how-to-use-fundamental-programming-concepts-to-achieve-your-personal-goals
categorymotivation
json_metadata{}
created2016-08-24 13:42:45
last_update2016-08-24 13:42:45
depth1
children0
net_rshares57,691,340,696
last_payout2016-08-27 13:39:45
cashout_time1969-12-31 23:59:59
total_payout_value0.023 SBD
curator_payout_value0.006 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length13
author_reputation5,102,438,487,496
root_title"How to use fundamental programming concepts to achieve your personal goals"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)