Book Review: Beautiful Code

Beautiful Code, subtitled ‘Leading Programmers Explain How They Think’ is a collection of thirty plus essays by some of the top programmers around today. names like Charles Petzold and Brian Kernighan should be recognisable to any developer but many of the others may be less familiar but nonetheless have much to offer.

It’s also worth noting that all royalties from this book go to Amnesty International so hats off to all concerned for their generosity and efforts.

As the title suggests, this book is about code. It can be beautiful in any number of ways and each contributor explores a particular subject and provides code examples to illustrate a language construct, algorithm or principle that they hold to be beautiful. As an example of the developer’s craft at its finest, this book can’t help but impress.

Where it falls down somewhat for us is that much of the subject matter is rather esoteric and I suspect the majority of developers will go through their entire career without needing to worry about summing the bits in an arbitrary word. Self-taught programmers without the benefit of a Computer Science degree will probably struggle with much of the content but perhaps that’s not entirely the point of the book.

Firstly, this is most definitely not a book for reading through at the same pace you would most programming guides. The ideas, the code and the concepts usually require much thought and analysis on the part of the reader to really appreciate. This reviewer has twenty five plus years of commercial developer experience across dozens of languages and I found much of it pretty dense. It also gave me my first exposure to languages such as Haskell and MATLAB.

Even if much of the content may be somewhat heavy, what is far more accessible, in the main, is the discussion that accompanies it where the programmers describe their thought processes, reasoning and techniques for solving the problem. Here there is much great wisdom and for this alone, the book deserves close scrutiny.

Some of the simpler code examples were a revelation and it was astonishing to find a fully functional regular expression processor in a dozen or so lines as presented by Brian Kernighan. This was indeed beautiful code, compact yet still readable. As someone else noted, the art is not just knowing when to stop adding code but also when to stop removing it.

It’s certainly no lightweight book at 560 plus pages and it takes real effort to read although the nature of it means you can dip in to any chapter at random, following whatever interests you.

If you want to take your mindset as a developer to the next level, this is a good book. It’s also an interesting insight into certain programming problems and their solutions. You may also want to buy a copy just to support Amnesty International.

I would suggest though that this is a book you should browse at the bookstore first to be sure it’s something you’d enjoy although I’m confident that for many developers, it will be.

Book Review: Introduction to SQL Fourth Edition

Introduction to SQL is now in its fourth edition and this time around proudly displaying a 20th anniversary edition monicker. Weighing in at a shelf worrying 1000+ pages, it aims to provide everything you need to know about SQL from both the data manipulation and database creation angles.

The author, Rick F. van der Lans is well known on the lecture circuit as well as being an author and running his own consultancy at www.r20.nl.

After the obligatory introductory sections, the bulk of the first half is taken up by the SELECT statement and how to use it. The sample database used for all examples is based around a tennis club and serves to provide clear examples of how the SELECT statement can be phrased to produce different results.

Introduction to SQL covers all the expected areas including different types of join, null handling, subqueries and all the various aggregation and grouping variants. Being fully updated, it also includes newer features such as ROLLUP and CUBE that are becoming increasingly commonly used to analyse large datasets.

Most examples consist of SQL code, resulting rows and an explanation of what happened and why. Sometimes the author provides more than one way of doing things to show the pros and cons of each and there are the occasional Q&A sections to check understanding.

The book claims to cover SQL Server, Oracle, DB2 and MySQL but I found most of the code to be generic with only a few boxouts to cover alternative syntaxes. The style is rather dry and humourless which you may or may not prefer – certainly some IT books go too far the other way these days with pages of inane chatter. No such problem here.

The next section is a fairly short discussion on manipulating data – deleting and amending. This is only reasonable though as the bulk of difficulty in these areas is getting the SELECT part right. After that it’s on to creating database objects

Table and index creation, keys, constraints and views get fairly thorough coverage although I’d have liked a little more on referential integrity. I was pleased to see a good section on stored procedures which often get ignored in SQL books unless they’re server specific titles.

Another area that was welcome was the use of embedded SQL in other languages. Many developers will be using this method of access almost exclusively so this section plus the ODBC coverage will be of great help. The book also covers transactions and multi-user issues of which the latter is especially important. There is also some examination of Dynamic SQL and the important role of cursors when working with SQL in a programming environment.

The book finishes off with 3 appendices providing a reference to SQL syntax and a bibliography. A useful bundled CDROM containing a copy of MySQL 5.07 plus WinSQL a GUI front end so you can try the examples at home.

On balance I thought this was a good title, both as a tutorial and as a reference because of its fairly exhaustive coverage of all options. If there was a bit more on database design practices and building in data integrity, it would be a great book. Whether you’re new to SQL or need a useful memory jogger and reference, Introduction to SQL would be a good choice.

Book review: Digital Retro – Gordon Laing

Another reprint of an old review from PCBookReview.com

People of my age grew up during one of the most exciting periods in computing history. Computers were just moving from the business world of mainframes, time-sharing and minicomputers and in to the domain of the personal user. For the first time, it was feasible for a member of the general public to get their hands on a real computer and to be able to do new and exciting things with them. The roots of this movement can be traced back to the mid 70’s and the MITS Altair 8800 which could be bought in kit form or pre-assembled. Of course, others, especially at the Homebrew Computer Club in Silicon Valley were working on their own home made devices for no other reason than they could.

From these humble beginning, a huge industry was spawned that produced multitudes of different computers, none of which were compatible with each other the way the ubiquitous PC is today.

Anyone who was involved with microcomputers between the golden years of 1975 to around 1990 will remember the intense rivalry. Were you a Speccy fan or a Commodore C64 user? Were you allied to the Atari ST or Commodore Amiga? Did the Atari 800 or Apple II impress you?

Digital Retro by Gordon Laing draws on his regular retro column in the sadly now defunct PCW magazine and brings together some 44 machines, including key games consoles, that were released between 1975 and 1988. Along the way you can read about the Commodore Pet, BBC Micro, Oric 1 and Dragon 32 as well as lesser known or vaguely remembered machines such as the NASCOM 1, Tangerine Microtan 65, Jupiter Ace and the ill fated Mattel Aquarius which has the dubious distinction of having the shortest period on the market, being withdrawn after just 6 months.

Each machine gets an ‘overview’, ‘a company history’, ‘did you know?’ and what ‘happened next’ sections along with all new photography of each machine. This makes a nice change as many machines are always documented with the same old tired images. The new ones are often large, high quality and in many cases show how the machines have fared over the years – the PET had a few rust marks!

The text is fascinating and full of interesting snippets. I found the background information particularly absorbing, especially on some of the less well known machines. Gordon Laing has managed to interview a great many industry names including various Tramiels, Chuck Peddle and Joe Decuir and it shows in the resulting insights.

I noticed one typo where the Atari ST’s special features had been repeated for the Acorn Archimedes which was a pity but otherwise everything seemed accurate.

The machines are presented in release date order providing an interesting overview of computer development during the period. A side effect of this is that some machines appear so glaring underpowered compared to their peers that one has to ask ‘why did they bother?’. You may also do a double take on the original IBM PC – a cassette port?

Naturally there are some gaps, mainly due to a lack of example machines in good enough condition to photograph or simply for space reasons. I would have liked to have seen the Enterprise 128, Sord M5 and the almost unknown DAI which I seriously considered against the Atari 400 when I was looking for my first computer back in 1980.

Conclusion

Overall this is a fine book and Gordon Laing is to be congratulated on the breadth and accuracy of the material it presents. The all new photography is the icing on the cake. I can only hope that an expanded edition or a volume 2 appears at some point to mop up the remaining machines from the golden age of home computing.

Book review: The Myths of Innovation – Scott Berkan

I used to run a web site that featured reviews of IT/photography related books. It’s gone now but I thought I’d put the old reviews up here in case anyone finds them useful. Here’s the first.

We’ve always been led to believe innovation comes from super-talented people or small focussed teams having a eureka moment. Alas, the reality is all too often rather less romantic. Scott Berkan has produced a thought provoking new book on the subject that aims to clear away all our misconceptions about innovation and provides some new insights along the way.

What the book isn’t is a tutorial or magic bullet that will help you unleash a torrent of brilliant ideas. Instead, the author takes us on a fascinating journey through history providing background, stories and advice on what not to do and which supposedly tried and tested methodologies are in fact nothing of the sort.

Unlike many books in this field, The Myths of Innovation is a pleasantly light read. The author has a lucid writing style and plenty of anecdotes and stories that all help to illustrate the points he is making.

The book is divided in to ten chapters, each of which covers a particular concept or misconception. The first one, The Myth of Epiphany sets out the direction for the whole book and quickly destroys the story of Newton and his apple moment in the ‘discovery’ of gravity. The reality is if anything rather more impressive, years of study, multiple disciplines and ideas all being pulled together to produce a fully formed set of theories and formulae

For me, the real richness in the book is the wealth of stories both historical and contemporary, each of which illustrates a point. I certainly had many of my beliefs neatly demolished as tales of Einstein, Jeff Hawkins (founder of Palm), Steve Jobs and many more are told.

One concept I particularly liked was the importance of understanding the real problem. For instance, Edison didn’t want to create a lightbulb, he wanted something that could be wired up in cities that would make money. Equally, the Palm Pilot spec wasn’t for this function or that function, it was to fit in a shirt pocket, sync with a PC, be easy to use and cost less than $299. Everything else was just fluff.

I can safely say the book lives up to its title. It does a neat and surprisingly entertaining job of debunking almost everything you ever believed or hoped was true of innovation and the processes behind it. It will leave you hungry to explore new ways of trying to discover and created armed with the new insights it provides.

For such a compact book, I did feel the price was a little high (although Amazon’s prices are particularly keen on this book) but on balance, if you have an interest in innovation, either within yourself or by inspiring others, this is a fine read that will probably become a classic in its field.

Finally, I have to take my hat off to the writer of the colophon who went well above and beyond the call of duty with a bizarre page and a half that should worry anyone that deals with him or her on a daily basis.