code reading dds

Code ReadingIntroduction

I regret to report that I've just recently looked again at my programs for prime factors and tic-tac-toe, and they are entirely free of any sort of comments or documentation.
— Donald E. Knuth

Software source code is the definitive medium for communicating a program's operation and for storing knowledge in an executable form. You can compile source code into an executable program, you can read it to understand what a program does and how it works, and you can modify it to change the program's function. Most programming courses and textbooks focus on how to write programs from scratch. However, 40% to 70% of the effort that goes into a software system is expended after the system is first written. That effort invariably involves reading, understanding, and modifying the original code. In addition, the unrelenting, inevitable accumulation of legacy code; the increasing emphasis placed on software reuse; the high human turnover rates associated with the software industry; and the rising importance of open-source development efforts and cooperative development processes (including outsourcing, code walkthroughs, and extreme programming) make code reading an essential skill for today's software engineer. Furthermore, reading real-life well-written code can give you insights on how to structure and program nontrivial systems, a skill that cannot be learned by writing toy-sized programs. Programs should be written to be read, and, whether they are or not, they need to be read. Although code reading is, in the words of Robert Glass, "an undersung, undertaught activity," [Gla00] this need not be so.

In this book you will learn how to read code that others have written through concrete examples taken from important, real-life, open-source code systems. We adopt a liberal definition of code and take it to encompass all machine-readable elements of a project: source code (and its commentary), documentation, executable programs, source code repositories, design diagrams, and configuration scripts. Having mastered the book's contents, you will

Although the book starts with a revision of basic programming structures, we assume you are familiar with either C, C++, or Java and able to use simple tools to examine on-line the code of the examples we provide. In addition, exposure to the systems and applications we discuss, although not required, will enhance your understanding of the presented material.

In the remainder of this chapter you will find a discussion of the different reasons that will prompt you to read code together with the appropriate corresponding reading strategies, and a brief "instruction manual" for following the material we present. Happy (code) reading!


Book homepage | Author homepage

Valid XHTML 1.0! Level Triple-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0 (C) Copyright 2000-2003 D. Spinellis. May be freely uploaded by WWW viewers and similar programs. All other rights reserved.
Last modified: 2003.05.12