Chapter 8 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.

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.

16. The scope of a local variable cannot contain the definition of another variable with the same name.

17. A qualified name is prefixed by its class name or by an object reference, such as Math.sqrt or other.balance.

18. An unqualified instance field or method name refers to the this parameter.

19. A local variable can shadow a field with the same name. You can access the shadowed field name by qualifying it with the this reference.

20. A package is a set of related classes.

21. The import directive lets you refer to a class of a package by its class name, without the package prefix.

22. Use a domain name in reverse to construct unambiguous package names.

23. The path of a class file must match its package name.

24. Unit test frameworks simplify the task of writing classes that contain many test cases.

25. The JUnit philosophy is to run all tests whenever you change your code.