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 USEFULIn 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 ... |