Monthly Archives: August 2011

Question 1 – is GDP a good measure of a country’s health?

image courtesy of http://www.flickr.com/photos/donaldtownsend/

GDP, or Gross Domestic Product, is a measure of the economic output of a country.  It seems to be an unspoken assumption by nearly all economic commentators that more GDP is better than less.  If the GDP of a country declines, then we call that a recession.  If it grows, we call that a ‘healthy’ economy.  Indeed, we seem to use all sorts of anthropomorphic adjectives to describe the world of financial transactions.  Think about it:

The economy is struggling.  The economy is recovering.  The economy needs to be stimulated.  The economy is crippled. The economy is healthy.  The economy is at risk.  The economy is growing.

In fact, if we didn’t know what the word meant, we might hazard a guess that ‘The Economy’ is the name of a friend’s slightly wayward toddler.

Which brings me to my question.  A toddler, of course, should be growing – physically, emotionally, and intellectually.  But not all growth is good.  We are told that it is good for a country to experience continuous economic growth of a few percent every year.  But unrestrained, exponential growth of living cells is know by a different name.

We call it cancer.

If our industrial output grows at, lets say a nice conservative rate of 2 percent a year, then after 10 years we will be producing 21 percent more goods and services than when we started.

After a hundred years we will be producing seven times as much.

After a thousand years, we will be producing just shy of 400 million times as much.

Seriously.  Try the math.  Enter 1.02 to the power of 1000 in your calculator.  The answer is 398,264,651.

400 million times as many cars.  400 million times as many cell phones.  And filling 400 million times as many landfills.

Does your city have space for 400 million landfills?

And if not, then how should we measure the health of a country?

 

Learning to Ask Questions

It’s been suggested to me that it would be a good idea to get in the habit of asking questions, as well as trying to answer them.  So in that spirit, I’ll be doing a series of posts about questions that I have on my mind.  Hopefully these will become themes that I explore in greater depth over the next few months, but for now we’ll focus on just outlining some areas of inquiry that intrigue me…

Mine Over Matter

This is how I spent yesterday morning: jumping in a lake, mountain biking over rocks, roots and gravel, and running the trails around Kelso Quarry.  All in all a complete blast!

 

Marathon Pains

In theory, running should be the most undramatic of sports.  The requirements are simple; you turn up at the start line, and when the horn sounds you run the allotted distance to the finish, at whatever pace you are capable of maintaining.

However yesterday’s inaugural Barrie Half Marathon drove home the point to me that even a simple half-marathon can be a dramatic event.

It started well, with the course taking us around Kempenfelt Bay on trails that I train on regularly.  This was home ground, and kept my breathing steady and my body loose.

The course brought us back past the start/finish line about half-way through the race.  I crossed the 10k marker enjoying the cheering crowds, running well and on pace to finish close to my personal best time.

A few minutes later I passed the 11k marker limping on knees that had suddenly refused to work.  My quads had tightened up and I my legs would only allow me to run a hundred metres or so before requiring me to stop, stretch, and walk.

So, I walked, limped and hobbled the next ten kilometers. This was a humbling experience for me – I’m used to experiencing races if not from the front, then at least from well up into the ‘business end’.  This time, first I watched the guys I’d been pacing out with vanish into the distance, and then most of the rest of the pack run past me.  At about 17k I was dropped by a guy with only one leg.

Now, this being running, everyone was supportive.  Practically every runner and volunteer called out encouragement or checked if I was OK.  And so, despite running probably the slowest race of my life, and crossing the line at two hours and five minutes, I finished.

And it was worth it.

Coffeescript

New technology of the week, and hot contender for the title of ‘my current favourite language’, is coffeescript.

I’ve thought for a long time that javascript is a horrible language with a wonderful language inside trying to get out.   Coffeescript may well be that language.  While at it’s heart it is still fundamentally javascript, and can be used anywhere javascript can (so far I’ve used it in node.js and in the browser), it steers you around the worst mistakes of the underlying language.  Variable scoping and binding is handled better, function declarations are clearer, iterations and comprehensions are integrated neatly into the language, and your code can be more succinct.

This week I re-wrote our mobile web platform, replacing our existing jquery-ui based rendering with coffeescript and backbone.  There was definitely a learning curve involved, but the effort was worthwhile; and now we have a code base that is considerably more manageable than the previous version.

Examples

l=[1,2,3]
square = (x) -> x*x
squares = (square(x) for x in l)

Or even

squares = (x*x for x in [1,2,3])

And from our actual code: we store data as json-encoded strings in the browser’s local storage.  This function takes a predicate (i.e. any function that returns a boolean) and uses it to find the keys of all elements in local storage that match.

view : (predicate) ->
    (key for own key,value of localStorage when predicate (JSON.parse(value))

Which could then be used to get all objects that have a field ‘type’ set to ‘response’ as follows:

dockeys = view (doc) -> doc.type=='response'

Neat, huh?   Head over to http://jashkenas.github.com/coffee-script/ and try it out yourself!