Java Reference
In-Depth Information
CHAPTER SUMMARY
1. A class should represent a single concept from the problem domain, such as
business, science, or mathematics.
2. The public interface of a class is cohesive if all of its features are related to the
concept that the class represents.
3. A class depends on another class if it uses objects of that class.
4. It is a good practice to minimize the coupling (i.e., dependency) between
classes.
5. An immutable class has no mutator methods.
6. A side effect of a method is any externally observable data modification.
7. You should minimize side effects that go beyond modification of the implicit
parameter.
8. In Java, a method can never change parameters of primitive type.
374
375
9. In Java, a method can change the state of an object reference parameter, but it
cannot replace the object reference with another.
10. A precondition is a requirement that the caller of a method must meet. If a
method is called in violation of a precondition, the method is not responsible
for computing the correct result.
11. An assertion is a logical condition in a program that you believe to be true.
12. If a method has been called in accordance with its preconditions, then it must
ensure that its postconditions are valid.
13. A static method is not invoked on an object.
14. A static field belongs to the class, not to any object of the class.
15. The scope of a variable is the region of a program in which the variable can be
accessed.
Search WWH ::




Custom Search