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

The Great Silence – Milan Cirkovic ****

The great 20th century physicist Enrico Fermi didn’t say a lot about extraterrestrial life, but his one utterance on the subject has gone down in legend. He said ‘Where is everybody?’ Given the enormous size and age of the universe, and the basic Copernican principle that there’s nothing special about planet Earth, space should be teeming with aliens. Yet we see no evidence of them. That, in a nutshell, is Fermi’s paradox.

Not everyone agrees that Fermi’s paradox is a paradox. To some people, it’s far from obvious that ‘space should be teeming with aliens’, while UFO believers would scoff at the suggestion that ‘we see no evidence of them’. Even people who accept that both statements are true – including  a lot of professional scientists – don’t always lose sleep over Fermi’s paradox. That’s something that makes Milan Cirkovic see red, because he takes it very seriously indeed. In his own words, ‘it is the most complex multidisciplinary problem in contemporary science’.

He points out th…

The Happy Brain - Dean Burnett ****

This book was sitting on my desk for some time, and every time I saw it, I read the title as 'The Happy Brian'. The pleasure this gave me was one aspect of the science of happiness that Dean Burnett does not cover in this engaging book.

Burnett's writing style is breezy and sometimes (particularly in footnotes) verging on the whimsical. His approach works best in the parts of the narrative where he is interviewing everyone from Charlotte Church to a stand-up comedian and various professors on aspects of happiness. We get to see the relevance of home and familiarity, other people, love (and sex), humour and more, always tying the observations back to the brain.

In a way, Burnett sets himself up to fail, pointing out fairly early on that everything is far too complex in the brain to really pin down the causes of something as diffuse as happiness. He starts off with the idea of cheekily trying to get time on an MRI scanner to study what his own brain does when he's happy, b…

Bodyology - Mosaic Science ****

It's a good sign when you pick up a book intending to read one chapter and end up reading three. It's very moreish. This is because it's made up of short, self-contained articles, originally published on a website. Often an edited collection of articles by different authors suggests a boring read, but here the articles are good pieces of journalism with plenty to interest the reader.

The topics are all vaguely human body related, but thankfully not all medical (not my favourite subject) - so, for example, as well as stories of a person cured of Lyme disease by bee stings or a piece on miscarriages we get topics like the effects on the body of being struck by lightning or falling from a high place. Even some more explicitly health-related matters, such as the impact of losing your sense of smell, were engaging enough to get me past my medical squeamishness.

The only reason I can't give the collection five stars is because of one aspect of the writing style that runs throu…