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

Ancestral Night (SF) - Elizabeth Bear *****

Only a couple of weeks ago, reviewing a 1960s SF book, I bemoaned the fact that science fiction novels of ideas are less common now. Although it is correctly labelled a space opera, Ancestral Night delivers ideas with aplomb.

Let's deal with the space opera aspect first. Elizabeth Bear provides some excellent adventure scenes in space, and we've the usual mix of huge spaceships and interesting aliens. Main character Haimey Dz is an engineer on a ship that salvages wrecks - but, as we gradually discover - she also has a forgotten past. A major feature of the storyline (one that seems to link to the medieval idea of the lost wisdom of the past) is ancient technology from a long-dead race with capabilities, notably manipulating spacetime mentally (Bear has yet to point out that the travel technologies used here could manipulate time as well as space), which fit well with Arthur C. Clarke's magic definition.

I particularly liked the (surely intentional) nods to the much-misse…

The Creativity Code - Marcus du Sautoy *****

At first glance this might just be another 'What AI is good at and not so good at' title. And in a way, it is. But, wow, what a brilliant book! Marcus du Sautoy takes us on a tour of what artificial intelligence has achieved (and possibly can in the future achieve) in a range of fields from his own of mathematics, through game playing, music, art and more.

After a little discussion of what creativity is, we start off with the now very familiar story of DeepMind's AlphaGo and its astonishing ability to take on the hugely challenging game of Go. Even though I've read about this many times before, du Sautoy, as a Go player and mathematician, gives a real feel for why this was such a triumph - and so shocking. Not surprisingly he is also wonderful on what mathematicians actually do, how computers have helped them to date and how they have the potential to do far more in the future. After all, mathematics is by far the closest science to game playing, as it has strict rule…

The Demon in the Machine - Paul Davies *****

Physicists have a habit of dabbling in biology and, perhaps surprisingly, biologists tend to be quite tolerant of it. (I find it hard to believe the reverse would be true if biologists tried to do physics.) Perhaps one reason for that tolerance is Schrödinger’s lecture series and book What is Life?, which had a huge impact on molecular biology and with a reference to which, not surprisingly, Paul Davies begins his fascinating book. 

At the heart of the The Demon in the Machine (we'll come back to that demon in a moment) is the relationship between life and information. In essence, Davies points out that if we try to reduce life to its simple physical components it is like trying to work with a computer that has no software. The equivalent of software here is information, not just in the best publicised aspect of the information stored in the DNA, but on a far broader scale, operating in networks across the organism.
This information and its processing gives life its emergent compl…