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

Conjuring the Universe - Peter Atkins *****

It's rare that I'd use the term 'tour de force' when describing a popular science book, but it sprang to mind when I read Conjuring the Universe. It's not that the book's without flaws, but it does something truly original in a delightful way. What's more, the very British Peter Atkins hasn't fallen into the trap that particularly seems to influence US scientists when writing science books for the public of assuming that more is better. Instead of being an unwieldy brick of a book, this is a compact 168 pages that delivers splendidly on the question of where the natural laws came from.

The most obvious comparison is Richard Feynman's (equally compact) The Character of Physical Law - but despite being a great fan of Feynman's, this is the better book. Atkins begins by envisaging a universe emerging from absolutely nothing. While admitting he can't explain how that happened, his newly created universe still bears many resemblances to  nothing a…

Beyond Weird - Philip Ball *****

It would be easy to think 'Surely we don't need another book on quantum physics.' There are loads of them. Anyone should be happy with The Quantum Age on applications and the basics, Cracking Quantum Physics for an illustrated introduction or In Search of Schrödinger's Cat for classic history of science coverage. Don't be fooled, though - because in Beyond Weird, Philip Ball has done something rare in my experience until Quantum Sense and Nonsense came along. It makes an attempt not to describe quantum physics, but to explain why it is the way it is.

Historically this has rarely happened. It's true that physicists have come up with various interpretations of quantum physics, but these are designed as technical mechanisms to bridge the gap between theory and the world as we see it, rather than explanations that would make sense to the ordinary reader.

Ball does not ignore the interpretations, though he clearly isn't happy with any of them. He seems to come clo…

Big Bang (Ladybird Expert) - Marcus Chown ****

As a starting point in assessing this book it's essential to know the cultural background of Ladybird books in the UK. These were a series of cheap, highly illustrated, very thin hardbacks for children, ranging from storybooks to educational non-fiction. They had become very old-fashioned, until new owners Penguin brought back the format with a series of ironic humorous books for adults, inspired by the idea created by the artist Miriam Elia. Now, the 'Ladybird Expert' series are taking on serious non-fiction topics for an adult audience.

Marcus Chown does a remarkable job at packing in information on the big bang, given only around 25 sides of small format paper to work with. He gives us the concepts, plenty about the cosmic microwave background, plus the likes of dark energy, dark matter, inflation and the multiverse. To be honest, the illustrations were largely pointless, apart from maintaining the format, and it might have been better to have had more text - but I felt …