Friday, August 12, 2011

Reading list

Books have improved my knowledge about programming, creating users interfaces, and how software has a life after the first deliverable. I have also found there are many awful books which are a waste of time and money. This is a shame as I believe a good book will convey a topic in more depth than a series of blog posts or examples on the Internet. Here is my list of books which I value and can recommend to you.

Programming Pearls, 2nd Edition, John Bently

Originally a series of essays for the ACM. They form a superb book on the subject of how to write software. Most of the examples are in C and an analysis of how malloc works may no longer be relevant. For me though, this added to the interest as I got to think again about how memory is managed and data structures are implemented.

Where Bently excels is by demonstrating how a problem can be thought through and analysed. The "Back of the envelope" chapter describes how to estimate the volume of water which flows down the Mississippi river. This is a master class in lateral thinking.

A theme that runs through the examples is the creation of test harnesses to prove that the program being developed works. It is refreshing to see automated testing being focused on in a book which by computing standards is now considered a classic.

The Mythical Man Month and Other Essays on Software Engineering, Frederick Brooks

Based on his experience of working on IBM’s OS/360 in the 1960s, Frederick Brooks argues against the idea that adding more developers to a team will accelerate the production of code. He demonstrates how new developers have to learn the code base and in fact decelerate development time as experienced people stop writing code to teach them.

This is a great read for anyone who works as a developer as Brooks’ experiences with punch cards and rooms full of documentation for one system are relevant now.
This is an essential read though for any manager of a business who employs software developers within their company.

Refactoring, Martin Fowler

This is the book which has most improved my understanding of object orientated coding. Before reading this book I was unsure about changing working code no matter what state it was in.

Using a series of refactorings Martin Fowler shows how the design and quality of a code base can be improved by making many small changes. Changes which alter the code but not the behaviour of the system. This is made possible by having a good collection of tests that assert how the code being changed behaves.

This is a book which I return to often. It is a book which has had a profound impact on software development. Most of the patterns described are now built in to development tools like ReSharper and CodeRush.

Agile Web Development with Rails 1.2, Dave Thomas

The first section of this book shows how to build simple web applications and in doing so it introduces key aspects of the Rails framework. The second section is a detailed look at the framework with chapters dedicated to ActiveRecord, ActionView, ActionController and ActionMailer.

This is the book I am currently reading as I am creating a Rails app in my spare time. It is woefully out of date as Rails is now at version 3 (with 3.1 soon to be finalised). So I read all the examples wondering what has changed.

Design Patterns, Gamma, Helm, Johnson, Vlissidies

A classic book about object orientated design and one of the first books to present a series of patterns for writing code. Based around a case study for building a document editor, the patterns are split in to three groups; Creation Patterns, Structural Patterns and Behavioural Patterns.

Most of the code examples are in C++ and a few are in SmallTalk and whilst I only have distant memories of C++, I found the code examples interesting and readable.
Some of the patterns in this book are now considered anti-patterns (Singleton and maybe Template method) but most are well worth understanding. What these patterns also provide is a vocabulary for developers to use when discussing code. Often a solution to a problem can be articulated by citing one of these patterns.

JavaScript: The Good Parts, Douglas Crockford

What Refactoring did to improve my knowledge of statically typed, object orientated programming, “JavaScript: The Good Parts” equally did to improve my knowledge of dynamic, prototype programming.

Douglas Crockford believes that some parts of the languages are great, some are bad and the rest are just ugly. Most of the book is spent explaining how the good parts can be used to form an expressive and flexible language. The remainder highlights the bad and the ugly which, if avoided, make the good parts even better.

This book is so rich in content and so terse that I read it three times. I now understand the power of closures in JavaScript and how best to construct objects which are secure and extensible.

Patterns of Enterprise Application Architecture, Martin Fowler

PoEAA follows on from Martin Fowler’s Refactoring and he has assembled a set of patterns for writing software where the code base is organised in to layers of responsibility. The most common types of layers are the data layer and the presentation (or User Interface) layer.

Once again I am impressed by the way that Martin Fowler manages to formalise patterns in software engineering and the impact that he has on the frameworks that I use. I read this book soon after using NHibernate the .Net Object Relational Mapping tool and it felt like I was reading the specification for NHibernate. The same is true for Active Record in Ruby on Rails, and many of the Model View Controller (MVC) frameworks that exist. I must add that I do not think that Martin Fowler was the first to discover these patterns. For example Trygve Reenskaug created the MVC pattern while working at Xerox Parc. But what Martin Fowler has is the ability to collate and present the patterns so they become accessible and readable to all. He also draws upon the experience of many so the pattern is applicable to the time.

The Little Schemer, 4th Edition, Friedman and Felleisen

The Little Schemer is the most unique and challenging book on programming that I have ever read. But then it is about recursion, a topic which can twist even the nimblest brain.

Scheme is a dialect of LISP so it is a language where all data structures are lists and functions are also data. The Little Schemer builds up through its narrative “Ten Commandments” for writing idiomatic and valid Scheme programs. At first this is easy to follow as the recursion is shallow and mainly focused upon creating functions and safely processing the lists. The later chapters are much harder as the recursion gets deeper and functions start generating functions. This builds to the final masterpiece, the applicative-order Y combinator.

I enjoyed this book. It was challenging, more challenging than Dante’s the Divine Comedy. However, it opened my mind to a world of functional programming that I am just starting to explore. I will be downloading a Scheme at some point so I can work through the code and further my understanding.

Domain Specific Languages, Martin Fowler

The final book on this list form Martin Fowler and his most recent. This has his usual style of a detailed example demonstrating the application of the patterns to follow. The topic this time is how to write Domain Specific Languages (DSLs). The focus is how DSLs can help to configure complex applications, like the main example called “Miss Grants Controller”. This is a complicated state machine which can be configured to open a door only when the correct sequence doors have been opened and lights switched on.

This book is a small study on computer language design. It covers; lexing, syntactic analysis, the specification of grammer using BNF and the role of Abstract Syntax Trees to name but a few. As I have not previously studied language design or the writing of compilers, this was a great introduction to the topic.

For me the best chapters came towards the end. Here Martin Fowler presents some alternative models of computation. They are alternative because they are not imperative computation which is the most common. They relate to DSLs as they are often harder to configure and their operation can not be immediately understood through just reading the code. So DSLs are a very useful tool to simplify the programming of these programming models. Of the four presented I was especially interested in the “Decision Table” and the “Production Rules” models as both of these solve problems I often encounter at work.

Designing with web standards, Jeffery Zeldman

This is one of the few books I have read that completely changed how I thought about working. Prior to reading Designing with web standards I created HTML pages using tables to layout the page. I remember being very pleased with a site I made for Comet. I managed to make an image of a vacuum cleaner break the gird just as the designer had planned. To do that needed four nested tables and the image had to be cut in to several pieces. It was hard work, and it was wrong, as I found out when I read Designing with web standards. I then understood the idea that the HTML is a document. And this document is description of the content. The CSS is the presentation and the JavaScript adds any extra frills if the client supports it.

I am sure of one thing. That back in 2003, when Jeffery Zeldman published this book, I was not the only person making web sites this way. But we all soon stopped. I have read other books since which have helped me to understand more about the detail. But it is this book which changed my thinking on the topic.