ITEC 2610 Lecture Notes - Lecture 1: Mutator Method, Static Variable, Reserved Word
Document Summary
The name of the class should be a noun and should also relate to the topic of the class. A class represents a single concept from a problem domain, such as a business, science, or mathematics. The public interface of a class is cohesive if all of its features are related to the concept that the class represents. A class depends on another class if its methods use that class in any way. It is best to decouple input/output from the work of your classes: place the code for producing output or consuming input in a separate class. A mutator method changes the state of an object. Accessors ask the object to compute a result without changing its state. An immutable class has no mutator methods. In an immutable class, it is best to separate accessors and mutators. References to an object in an immutable class can be safely shared.