Objects
The purpose of class modeling is to describe objects. An object is a concept, abstraction, or thing with identity that has meaning for an application.
Objects usually surface as proper nouns or specific references when you talk to users about a problem. Not every object has to exist physically:
Classes
An object is an instance — an occurrence — of a class. A class describes a group of objects that share the same properties (attributes), behavior (operations), relationships, and meaning.
Classes tend to show up as common nouns in problem descriptions, where objects show up as proper nouns. Every Person has a name and birthdate and may work at a job; every Process has an owner, a priority, and a list of required resources.
Class Diagrams
Graphic notation for classes and their relationships — describes the space of possible objects. Used for both abstract modeling and real program design. A class diagram corresponds to an infinite set of possible object diagrams.
Shows specific, individual objects and how they're linked at one moment. Useful for documenting test cases and walking through concrete examples.
Figure 3.1 shows a class on the left and three of its instances on the right.
Figure 3.1 — A class and its objects. The UML object symbol is a box reading objectName:ClassName, both underlined. An unnamed instance simply omits the object name, leaving :Person.
Note the naming convention used throughout the book: multiword names run together with an internal capital letter (JoeSmith) rather than a space or underscore. It's a popular OO convention, not a UML requirement.
Values and Attributes
A value is a piece of data. An attribute is a named property of a class describing a value held by every object of that class.
Figure 3.2 — Attributes are listed in the class box's second compartment, optionally typed after a colon. Object boxes list the actual value after an equal sign.
Operations and Methods
An operation is a function or procedure that may be applied to or by the objects in a class. hire, fire, and payDividend are operations on Company; open, close, hide, and redisplay are operations on Window. All objects in a class share the same set of operations.
File might declare a single print operation, implemented by separate methods for ASCII files, binary files, and digitized pictures — different code, same logical task, same generic name.
name, birthdate, changeJob, and changeAddress are all features of Person — feature is the umbrella term for "attribute or operation."
Figure 3.4 — Operations sit in the class box's third compartment. move takes a Vector; select takes a Point and returns a Boolean; rotate takes an input float defaulting to 0.0.
Object boxes never list operations — behavior doesn't vary between objects of the same class, so showing it per-object would only add noise.
Summary of Notation for Classes
A class box has up to three stacked compartments — name, attributes, operations — each optional beyond the name itself.
Figure 3.5 — General notation for a class box, three compartments deep.