Summary
In this chapter, we covered two important tasks that every programmer should include in their code, regardless of the language used. The first was documentation. Comments and Javadocs can be critical in the maintenance of existing code or in adding new features. You may think you will never forget why you coded in a certain way, but 6 months from now, that memory may not be as accurate as it needs to be.
During the development of software, and once it goes into production, having the program write what it is doing to the console, or more commonly, to a file, can go a long way in tracking down bugs. Auditing software that is subject to regulations is another task logging can carry out. Never use System.out.print
or its cousins to display information about the operation of a program – use a logger. Either the Java logger or an external logger such as Log4j2 should be, must be deployed in your code.
Documenting your code is mandatory. Using logging to record events...