The Practice of Writing Excellent Code
One of the older arguments among programmers has to be, “What is programming?” Is it a trade or a science or something else? By its name, Code Craft would indicate the author leans towards it being a trade, more so than an abstract science.
This is a fun book to read– despite the comics and quotes ranging from Biblical to Tolkien that is liberally spread throughout the book and the lyrically-named chapters– once you start reading it, you realise it’s packed with practical advice. A lot of the book deals with– usually through cautionary examples– how time or management pressures lead to bad decisions and their consequences.
The book starts with “At the Codeface,” a section that deals with the technical and practical side of writing code: organising, naming things and documenting. This is broken up into several chapters on writing understandable code (grouping related functions, emphasis important code, etc.) and writing good comments. There’s a lot of short code examples, mostly in C/C++, showing how to do (or not) many of the subjects covered in the book.
The next section is “The Secret Life of Code” and covers debugging, finding problems, discovering efficiencies and security. This first starts with a chapter on the various tools available to the programmer; from code profilers to debuggers and other tools available. Other chapters look at the various types of testing (black box, glass box, etc.), error handling, security and efficiency.In “The shape of Code,” the reader is taught to deal with the high-level: architectures, design and code growth, specially designed software to grow as needs change over time.
“A Herd of Programmers,” takes a look at the real problems of working in teams. There’s more than one real-world example that hit home here. Covered here is are the general types of programmers, version control and issues related to teams in general, specifically how to get people working well together.
The next section, Part of the Process, deals with creating specifications, code review and the black art of time estimation.
Finally, “View from the top,” looks at the actual code development methodologies like the waterfall model, and agile methodologies as well as coming up with predictable schedules. The middle chapter looks at some of the different disciplines of programming, such as games and application programming with the particular challenges of each. The section then wraps up with a chapter on where to go from here.
At approximately 560 pages and almost 4 centimetres thick, this is a good-sized book to lug around on the subway. What it’s not is a dry text about the intricacies of developing computer-science good software- in fact, one of the book’s strengths is the numerous examples of how software development is done- and how to still do it well under non-ideal circumstances. Recommended.