book cover

Tricks of the Trade
(From Programming Pearls)

Here's a trick of the medical trade useful for anyone who donates blood. Before sticking the big needle in your arm, the nurse first pricks your finger for a few drops of blood. Some thoughtless nurses jab the pad of the index finger, which is the most sensitive spot of the most used finger. It is better to poke a less sensitive part (on the side, halfway down from nail to pad) of a less commonly used finger (the ring finger). This trick can make a blood donor's day a little more pleasant. Tell it to your friends before the next blood drive.

This book describe several similar tricks of the programmer's trade. These ideas are at an intellectual level not far above the trick of drawing blood samples from the side of the ring finger. Fortunately, these tricks are almost as useful, and not too much harder to apply. Three tricks play a particularly prominent role in the book.

Problem Definition

Searching out the real problem is the main topic of Column 1, and is a theme through the rest of the book.

The Back of the Envelope

Quick calculations are the subject of Column 7 and are used throughout the book.

Debugging

How do you turn a pseudocode algorithm into a real program? That ``small matter of programming'' is the topic of Column 5; testing plays an important role there and throughout the book. Section 5.10 tells a few fun stories about debugging, which is another theme in the book.

Other Tricks in the Book

The Epilog to the First Edition contains a list of ten design hints for programmers.

The index has an entry for engineering techniques. That contains pointers to back of the envelope, background data, debugging, design, elegance, problem definition, prototypes, specifications, testing, and tradeoffs.

A Talk About Tricks

I gave a one-hour talk about tricks at the Game Developers Conference in March, 2000. The talk is available as a Powerpoint Show. Closely related overhead transparencies are available in both Postscript and Acrobat. The talk concentrates on the three tricks described above (problem definition, back-of-the-envelope estimates, and debugging).

Most of the material in the slides is taken from the corresponding parts of the book. The first problem to be defined is from Section 12.1, and the second is from Problem 5.3 of my 1988 More Programming Pearls (the blood sample trick is from page 45 of that book). The back-of-the-envelope material is directly from Column 7, while the rules of thumb are scattered throughout the book. Three of the four software debugging stories are from Section 5.10; the medical story is from the book cited at the end of the section.

Copyright © 2000 Lucent Technologies. All rights reserved. Tues 7 Mar 2000