As system architects we have to foresee things that can change in the software specification over time. We have learned that a good system design is one that seperates the things that change from the things that do not. However in trying to foresee potential changes we often try to design for changes that may not happen. This leads to an over-engineered design which is more time consuming to implement and difficult to understand. Such a design becomes counter productive. While designing a software it is important to view the changes we anticipate along with their probablity of occurence. It is often a good idea not to design for a low probability change, if it significantly increases the design complexity.
Comments are an integral part of any program, even though they do not contribute to the logic. Appropriate comments add to the maintainability of a software. I have heard developers complain about not remembering the logic of some code they wrote a few months back. Can you imagine how difficult it can be to understand programs written by others, when we sometimes find it hard to understand our own code. It is a nightmare to maintain programs that are not appropriately commented. Java classes should contain comments at various levels. There are two types of comments; implementation comments and documentation comments. Implementation comments usually explain design desicisions, or a particularly intricate peice of code. If you find the need to make a lot of implementation comments, then it may signal overly complex code. Documentation comments usually describe the API of a program, they are meant for developers who are going to use your classes. All classes, methods and variables ...
Comments