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

Lost in Math - Sabine Hossenfelder *****

One of my favourite illustrations from a science title was in Fred Hoyle's book on his quasi-steady state theory. It shows a large flock of geese all following each other, which he likened to the state of theoretical physics. In the very readable Lost in Math, physicist Sabine Hossenfelder exposes the way that in certain areas of physics, this is all too realistic a picture. (Hossenfelder gives Hoyle's cosmological theory short shrift, incidentally, though, to be fair, it wasn't given anywhere near as many opportunities to be patched up to match observations as the current version of big bang with inflation.)

Lost in Math is a very powerful analysis of what has gone wrong in the way that some aspects of physics are undertaken. Until the twentieth century, scientists made observations and experiments and theoreticians looked for theories which explained them, which could then be tested against further experiments and observations. Now, particularly in particle physics, it…

Gravity! - Pierre Binétruy ****

I had to really restrain myself from adopting the approach taken by The Register in referring to Yahoo! by putting an exclamation mark after every word in the text when faced with reviewing Gravity! One thing to be said about the punctuation, though, is it makes it easier to search for amongst a whole lot of books on gravity and gravitational waves (the subtitle is 'the quest for gravitational waves') since their discovery in 2015.

Despite the subtitle, Pierre Binétruy gives us far more - in fact, gravitational waves don't come into it until page 160, which makes it really more of a book about gravity with a bit on gravitational waves tacked on than a true exploration of the quest. 

However, those early pages aren't wasted - Binétruy gives us plenty of detail on all kinds of background, for example plunging in to tell us about element synthesis, something you wouldn't expect in a book on gravitational waves. I also really liked a little section on experiments you can…

Brain Based Enterprises - Peter Cook ****

A quick flag on this one: it's a management/business book, and the four star rating is with that in mind. Brain Based Enterprises does contain a surprising amount of science, considering this, which is why it's here, but don't expect it to be like a four star pure science book.

This is an eclectic attack on the status quo of our ideas about business. Peter Cook suggest that much of current business simply isn't oriented to the realities of a modern, technological world, and that we need to handle things very differently in a knowledge-based economy.

The book is divided into three sections. For me, the most interesting was the first 'brainy people' part, as my own business doesn't have teams and such - but for those who do there are also 'brainy teams' and 'brainy enterprises' sections. Cook stirs together a heady mix of science - from psychology to economics - music (a passion of his and a significant part of the way he works) and business the…