What is a Class Diagram? * A class diagram describes the types of objects in the system and the various kinds of static relationships that exist among them. * A graphical representation of a static view on declarative static elements. * A central modeling technique that runs through nearly all object-oriented methods. * The richest notation in UML.
Essential Elements of a UML Class Diagram * Class * Attributes * Operations * Relationships * Associations * Generalization * Dependency * Realization * Constraint Rules and Notes
Classes
* A class is the description of a set of objects having similar attributes, operations, relationships and behavior.
Associations
* A semantic relationship between two or more classes that specifies connections among their instances. * A structural relationship, specifying that objects of one class are connected to objects of a second (possibly the same) class. * Example: “An Employee works for a Company” * An association between two classes indicates that objects at one end of an association “recognize” objects at the other end and may send messages to them. * This property will help us discover less trivial associations using interaction diagrams. * To clarify its meaning, an association may be named. * The name is represented as a label placed midway along the association line. * Usually a verb or a verb phrase. * A role is an end of an association where it connects to a class. * May be named to indicate the role played by the class attached to the end of the association path. * Usually a noun or noun phrase * Mandatory for reflexive associations * Multiplicity * The number of instances of the class, next