Skip to main content

Once upon and Algorithm - Martin Erwig ***

I've been itching to start reading this book for some time, as the premise was so intriguing - to inform the reader about computer science and algorithms using stories as analogies to understand the process.

This is exactly what Martin Erwig does, starting (as the cover suggests) with Hansel and Gretel, and then bringing in Sherlock Holmes (and particularly The Hound of the Baskervilles), Indiana Jones, the song 'Over the Rainbow' (more on that in a moment), Groundhog Day, Back to the Future and Harry Potter.

The idea is to show how some aspect of the story - in the case of Hansel and Gretel, laying a trail of stones/breadcrumbs, then attempting to follow them home - can be seen as a kind of algorithm or computation and gradually adding in computing standards, such as searching, queues and lists, loops, recursion and more.

This really would have been a brilliant book if Erwig had got himself a co-author who knew how to write for the public, but sadly the style is mostly heavy academic, so the cleverness is rather wasted. Sometimes this comes across in labouring points and at others in spending a lot of effort on what is little more than defining labels for things, rather than providing useful information and context for the reader. It's not that there's not a lot of good material in there, just that it's hard work to dig it out, where I'm sure the whole idea of using the stories was to make it more approachable.

Part of the problem is that the stories themselves don't always work very well as an analogy for what's happening in the computation. So, for example, in the section dealing with sorting he comes up with the task of sorting the tasks and places that Indiana Jones needs to deal with to find the Lost Ark. The unsorted list includes the likes of: disc, sunbeam, Marion and Nepal. The algorithm used involves finding the 'smallest' element... which somehow we are supposed to instantly see is Nepal. Using numbers would not have been so well-linked to the story, but at least it would have made some sense to the reader.

Perhaps the low point is the section that uses a part of the song 'Over the Rainbow' (giving us a tenuous story connection to The Wizard of Oz) to examine language and meaning. If you aren't familiar with musical notation, I'm not sure it's a very helpful analogy... and if you are, some of the ways it's used (particular the assertion of what bars are for) doesn't entirely make sense.

I was a professional programmer for a number of years, but without a computer science background. So I was very familiar with how to do this stuff, but knew nothing of the theory behind it. As such, I found the content of the book really interesting - and the story idea should have made it doubly brilliant - but the execution meant that it didn't deliver anywhere near as well as it could have. Even so, there's a lot to savour, and it's definitely worth persevering to get a feel for why computer programs involve far more than just 'cutting code.'


Hardback:  

Kindle:  



Review by Brian Clegg

Comments

Popular posts from this blog

Rockets and Rayguns - Andrew May ****

The Cold War period saw dramatic developments in science and technology, coinciding with the flourishing of the science fiction genre. In Rockets and Rayguns, Andrew May draws on the parallels between reality and fiction, each influencing the other.

Inevitably a major Cold War theme was the threat of nuclear war, and May opens with the bomb. It's fascinating that fiction got there first - nuclear weapons were featured in science fiction when many physicists were still doubting the practicality of using nuclear energy. Of course, it's a lot easier to simply take a concept and dream up a weapon than it is to make it for real - for example, H. G. Wells' prophetic nuclear bombs from his 1914 The World Set Free were nothing like the real thing. And some science fiction devices concepts - notably ray guns and force fields - came to very little in reality. However this doesn't prevent the parallels being of interest.

May gives us a mix of the science - describing how nuclear we…

Galileo Galilei, the Tuscan Artist – Pietro Greco ****

Near the beginning of John Milton’s epic poem Paradise Lost, he refers to a ‘Tuscan artist’ viewing the Moon through an optic glass. He’s talking about Galileo – one of history’s greatest scientists, but not the most obvious person to slap an ‘artist’ label on. Yet Galileo lived at a time – the Renaissance – when it was fashionable to dabble impartially in both the arts and sciences. Look up ‘Renaissance man’ on Wikipedia and you’ll see Galileo’s picture right there underneath Leonardo da Vinci’s. It’s a less well-known side to his life, but it crops up again and again – interspersed among his many scientific achievements – in this excellent new biography by Pietro Greco.

If you’re looking for interesting trivia, you’ll find plenty in this book. Galileo’s father was a musician with scientific leanings, who carried out some of the first experiments on musical acoustics – which Galileo may have assisted with. As a young professor of mathematics, Galileo delivered a couple of lectures on …

Enjoy Our Universe - Alvaro de Rújula ***

I’m going to start this review with a longish quote from the author’s preface, for several reasons. It explains De Rújula’s purpose in writing the book, as well as the audience he’s trying to reach, while giving a taste of his idiosyncratic writing style (which he keeps up throughout the book). It’s also a good starting point for discussing the book’s strengths and weaknesses. Here’s the quote:

'This book is not intended for (very) young kids nor for physicists. It is intended for anyone – independently of the education (s)he suffered – who is interested in our basic current scientific understanding of the universe. By "universe" I mean everything observable from the largest object, the universe itself, to the smallest ones, the elementary particles that "function" as if they had no smaller parts. This is one more of many books on the subject. Why write yet another one? Because the attempts to understand our universe are indeed fun and I cannot resist the tempta…