Skip to Main Content
Prefactoring
book

Prefactoring

by Ken Pugh
September 2005
Intermediate to advanced content levelIntermediate to advanced
240 pages
6h 28m
English
O'Reilly Media, Inc.
Content preview from Prefactoring

11.5. Logging

In pre-object days, I was adamant about having only a single return point for a routine. The return value could be logged before exiting the routine. With object-oriented code, my adamancy for a single return has dissipated. I can always add logging to a method with a proxy, as shown in this chapter. The calls to logging do not then intrude upon the logic for normal operations. The logging proxy can record the values of the input parameters and the return value.

LOGS ARE USEFUL

In the Cold War days, the United States built an antimissile defense system. The radar for this system used a phased-array antenna. A phased-array antenna moves its beam by electrical signals rather than mechanical means (the rotating antenna you see on ships and other places). This permits the antenna to track multiple objects in the sky. The idea was that the system could track an enormous number of incoming missiles, determine their flight path, and then launch missiles to intercept the incoming ones and blow them up. Needless to say, the system was rather complex. There was no possible way to test the entire system. It would have been expensive to launch 50 missiles against it on a similar trajectory to those expected to come from Russia.

A story that was going around at the time suggested building a huge underground bunker. In the bunker would be thousands of tape drives. When the attack came, the tape drives would log all the information from the antenna and the software. Then in ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Understanding Unittest.Mock

Understanding Unittest.Mock

Mario Corchero
Java™ Performance

Java™ Performance

Charlie Hunt, Binu John

Publisher Resources

ISBN: 0596008740Supplemental ContentCatalog PageErrata