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

Where are the chemistry popular science books?

by Brian Clegg
There has never been more emphasis on the importance of public engagement. We need both to encourage a deeper interest in science and to counter anti-scientific views that seem to go hand-in-hand with some types of politics. Getting the public interested in science both helps recruit new scientists of the future and spreads an understanding of why an area of scientific research deserves funding. Yet it is possible that chemistry lags behind the other sciences in outreach. As a science writer, and editor of this website, I believe that chemistry is under-represented in popular science. I'd like to establish if this is the case, if so why it is happening - and what can be done to change things. 


An easy straw poll is provided by the topic tags on the site. At the time of writing, there are 22 books under 'chemistry' as opposed to 97 maths, 126 biology and 182 physics. The distribution is inevitably influenced by editorial bias - but as the editor, I can confirm …

Artificial Intelligence - Yorick Wilks ****

Artificial intelligence is one of those topics where it's very easy to spin off into speculation, whether it's about machine conciousness or AI taking over the world (and don't get me onto the relatively rare connection to robots - cover designer please note). All the experience of AI to date has been that it has been made feasible far slower than originally predicted, and that it faces dramatic limitations. So, for example, self-driving cars may be okay in limited circumstances, but are nowhere near ready for the commute home. Similarly, despite all the moves forward in AI technology, computers are so-so at recognising objects after learning from thousands of examples - sometimes fooled by apparently trivial surface patterning - where humans can recognise items from a handful of examples.

Even so, we can't deny that AI is having an influence on our lives and Yorick Wilks, emeritus professor of AI at the University of Sheffield, is ideally placed to give us a picture …

Apollo 11 - David Whitehouse *****

The problem with doing a book about the Apollo programme is that it's hard to find something that hasn't been said before - but with the 50th anniversary of the first moon landing just weeks away, the publication of this elegant book is extremely timely, and science-reporting veteran David Whitehouse manages to make the story feel fresh, even if you're one of the just 20 per cent of the world population who were alive on the remarkable day in 1969.

Although he has worked a lot with New Scientist, Whitehouse was for many years a TV journalist, and that comes through in his impressively engaging prose as he takes us back to the origins of the US/USSR space race that would lead to the moon landing. He passes through the wartime aspects relatively quickly, but once the two superpowers are flexing their space technology muscles, Whitehouse achieves a near perfect balance between the far less-heard USSR side of the story and the US. This is probably the best bit of the whole bo…