Logging As Comments

last modified: December 23, 2008

One can potentially reduce code by making comments be logger notes and vise versa. The "logger" can be a text file for tracing or logging processes, but also a status-bar message for "debug mode" or internal process status messages.

logger("Wake Up");
while (! clockRing) {
  snooze();
  clockRing = clock.status;
},
yawn();
butt.move(outOfBed);

logger("Shave");
razor.wet()
face.putCreamOn();
razor.move(upAndDown);

logger("Get Dressed");
shirt.Find("work",style.Dilbert);
Etc...

I noticed this one day when my logger comments were nearly identical to my code-section comments (HeadlinesTechnique). In the spirit of OnceAndOnlyOnce, I consolidated most of them.


CategoryCodeComments


Loading...