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

Govert Schilling - Five Way Interview

Govert Schilling is an acclaimed and prize-winning freelance astronomy writer and broadcaster in the Netherlands. His articles appear in Dutch newspapers and magazines, but he also has written for New Scientist, Science and BBC Sky at Night Magazine, and he is a contributing editor of Sky & Telescope. He wrote dozens of books (including a couple of children’s books) on a wide variety of astronomical topics, many of which have been translated into English, German, Italian, and Chinese, among other languages. In 2007, the International Astronomical Union (IAU) named asteroid 10986 Govert after him, and in 2014, he received the David N. Schramm Award for high-energy astrophysics science journalism from the High Energy Astrophysics Division of the American Astronomical Society.His latest book is Target Earth . Why science? We live in troubling times. Fake news and conspiracy theories abound, and trust in science is diminishing. Many adults don't seem to realize that almost everythi...

The Compelling Scientific Evidence for UFOs - Erol A. Faruk **

  You can see immediately from the cover that this is no ordinary popular science book. There are some issues with The Compelling Scientific Evidence for UFOs , but if you have an interest in the field, particularly if, like me, you are an open-minded sceptic on the subject, I would consider reading it. This is because it is one of the few attempts to use proper scientific methods on UFO evidence, and though I don't agree with Erol Faruk's conclusions, it is refreshing not to see simplistic acceptance or knee-jerk denial of what is, for many people, a genuinely interesting topic. This isn't a general discussion of the UFO phenomenon - for that I'd recommend How UFOs Conquered the World by David Clarke, but instead gives us the author's take on a specific incident at Delphos, Kansas, where an alleged UFO landing left behind some very interesting material. The book has as an appendix made up of Faruk's scientific paper describing an analysis of the ...

The Infinite Book – John D. Barrow ****

Authors are often asked to review books on a topic they’ve written on themselves. The reasoning is sensible – they ought to know something about the subject – but there’s always that uneasy suspicion that there’s going to be a bit of bias creeping in. So I think it’s only fair to admit up front that I have written a book on infinity (of which more later). Infinity is a wonderful subject, because it’s intimately mind-bending (if the combination sounds paradoxical, that’s what infinity is all about) and gives you the chance to pull in all sorts of different concepts and assocations along the way, something Barrow does with great gusto. There’s a surprisingly large amount of coverage here for God, and for the universe, and the book jumps around from Aristotle to Hilbert’s Infinite Hotel (explained at great length), from the paradoxes of infinite sets to the paradoxes of time travel. Overall it’s an enjoyable journey that gives plenty of opportunity to be amazed and surprised. The...