“Consider the life cycle of a typical e-commerce project. First,
you might decide to architect your code around an object-relational
(OR) mapping tool, such as Java Data Objects or Hibernate, and J2EE
services, such as servlets and the Java Authentication and
Authorization Service. Next, you create interfaces and classes
representing business concepts such as a customer, SKUs, a shopping
cart, inventory, and payment authorization. At this point, your
code is clean and comprehensible.“Then you encounter some inexplicable, intermittent behavior.
‘Of course! I need logging,’ you say. So, you meticulously modify
all of the methods in all of the classes to uselog()
.
Now when a bug occurs, you examine the log and understand the
sequence of activities that lead to the bug…”