REVIEW - Code Reading - The Open Source Perspective


Code Reading

The Open Source Perspective


Diomidis Spinellis



Addison-Wesley Professional (2003)




Tim Pushman


December 2003



If you are considering putting together an academic course on computer science and want to include the art of code reading, this book would be an excellent starting point.

As stated in the introduction, how many novelists, painters, surgeons, even airline pilots, have learnt their trade by studying the work of others before them? Yet, in computer science, we are usually taught how to write programs, libraries and so on, with barely a reference to the skills of the masters before us. When much code was proprietary it was sometimes difficult to find code to guide us, but in this age of open source software, we now have a wide range of code to study.

The author suggests that reading code could be a standard part of a Computer Science curriculum and this book is an attempt to formalise the process, based around some samples of open source software.

The book can be broken down into four basic parts.

The first part gives an overview of the C language (and to a lesser extent C++) as used in open source software, with examples taken mainly from the source of NetBSD. It provides a brief synopsis of the various paradigms used in open source software as well as a short explanation of the syntax of C as it is used in the source base. C programmers will probably skip this section, although it is probably worth browsing through just to see how the Gods of BSD have tackled things.

The second and main part of the book covers the overall architecture of project, directory structures, build processes, coding standards and documentation of large, open source projects, wrapping up with a brief overview of the tools a programmer will use to find his way around a complex software project.

Of necessity, parts of this section are all too brief, which is a pity as this is really the meat of the book. It may have been better to skip the short overviews of object oriented programming, remote procedure calls and event based architecture and concentrated more on the open source way of approaching these subjects.

The third (and shortest) part is the fun part, Spinellis walks us through the process involved in adding functionality to an existing project ('hsqldb'), from first unpacking the code base through to testing and documenting the changes made. Anyone who has done this sort of thing will be nodding their head at some of the blind alleys and mistakes to be made on the way.

The final part is the usual set of appendices, which in common with many computer books these days, seem to serve no useful purpose other than to bulk the book out (in this case by 150 pages). Do we really need all the software licenses from the CD printed out?

Some areas are weak in the book, for instance, more on handling inter-library dependencies to get the projects working in the first place. There is very little on the KDE or Gnome frameworks, which is a pity because many programmers will start with these kind of projects, rather than network drivers and the like. There is very little coverage of the autotools system, which is the basis for most new open source projects (automake does not even appear in the index) and these omissions give the book a somewhat 'old-fashioned' feel, covering systems that were put together in the days of 'roll your own' build systems.

On the physical side, the book is well made, lies flat on the desk and the text is clear, well laid out and well organised, with a good index.

So who is this book useful for? If you are considering putting together an academic course on computer science and want to include the art of code reading, this book would be an excellent starting point. Each chapter includes a set of exercises that are obviously designed to be used in a classroom situation and the book follows a solid logical path through the subject. The course may want to skip the C overview and move the section on tools to an earlier part of the course.

Another group that would gain immensely from reading the book would be Windows programmers making the change to *nix systems, or who simply want to understand the code. The book provides an excellent overview of the whole system of open source software, from checking out of cvs through to the release process and would make a good primer before heading off into the wilds of 'apache.c'.

So, if you belong in these two groups, this book comes recommended. For all others, an interesting read but not essential.

Book cover image courtesy of Open Library.

Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.