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:  

Using these links earns us commission at no cost to you

Review by Brian Clegg

Comments

Popular posts from this blog

Mathematics with Love – Mary Stopes-Roe *****

Admittedly it’s early days (this review is written in January), but this, for me, is the surprise hit of the year so far! I approached this book with trepidation, but found it absolutely delightful. It is described on the cover as the “courtship correspondence of Barnes Wallis, inventor of the bouncing bomb”, and contains a series of letters between Wallis and his cousin and eventual wife Molly Bloxham, along with some useful annotation by their daughter, Mary. The courtship itself is not without difficulties, as Wallis was 18 years older than the 17-year-old Molly at the start of the correspondence, and her father, not surprisingly, wasn’t too pleased about the interest of such an elderly suitor, but that isn’t the only reason the letters are interesting – it’s also because of maths, and Wallis’s position in the UK as the engineering hero of the Second World War. (Incidentally, it seemed very strange to see letters addressed to “Barnes” – I had always assumed Barnes Wallis was a ...

Why Nobody Understands Quantum Physics - Frank Verstraete and Céline Broeckaert **

It's with a heavy heart that I have to say that I could not get on with this book. The structure is all over the place, while the content veers from childish remarks to unexplained jargon. Frank Versraete is a highly regarded physicist and knows what he’s talking about - but unfortunately, physics professors are not always the best people to explain physics to a general audience and, possibly contributed to by this being a translation, I thought this book simply doesn’t work. A small issue is that there are few historical inaccuracies, but that’s often the case when scientists write history of science, and that’s not the main part of the book so I would have overlooked it. As an example, we are told that Newton's apple story originated with Voltaire. Yet Newton himself mentioned the apple story to William Stukeley in 1726. He may have made it up - but he certainly originated it, not Voltaire. We are also told that ‘Galileo discovered the counterintuitive law behind a swinging o...

On Time - Jim Al-Khalili *****

By a small margin Jim Al-Khalili's The World According to Physics is my favourite of his books, both because the 'three pillars' concept at its heart works so well - but also because it's short. On Time is somewhat heavier, but thankfully not a wrist-buster. It might seem at first sight odd that a book on a subset of physics is considerably longer than one covering the whole thing, but time is one of those subjects that inevitably involves considerable complexities and needs depth. As Al-Khalili establishes, it's hard to think of any other scientific concept where our perception of it - what he refers to as manifest time or psychological time - is so different from the view from physics. Some physicists go so far as to suggest that time doesn't exist at all. In the book, Al-Khalili sets out (to my mind quite successfully) both to explain why they think this is the case, but also why it's not the best interpretation of time. I'd certainly note that I...