Chapter 11. A Complete Example

For a successful technology, reality must take precedence over public relations, for nature cannot be fooled.

—Richard Phillips Feynman

Most examples we have encountered in this book so far deal with isolated instances of code we tried to understand. In this chapter we will examine, by means of a larger example, how code-reading and understanding skills are applied in practice. We set as our goal the enhancement of the hsqldb database to natively support a new SQL date/time function. The function we chose to add, PHASEOFMOON, returns the moon's phase on a given date as a number in the range 0–100, with 0 representing a new moon and 100 a full moon. At over 34,000 lines of Java source, hsqldb is not a trivial ...

Get Code Reading: The Open Source Perspective now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.