Classes
A class describes a group of objects with
- similar properties (attributes),
- common behaviour (operations),
- common relationships to other objects,
- and common meaning (“semantics”).
For example, “employee: has a name, employee# and department; an employee is hired, and fired; an employee works in one or more projects”
Finding Classes
Finding classes in use case, or in text descriptions:
- Look for nouns and noun phrases in the description of a use case or a problem statement;
- These are only included in the model if they explain the nature or structure of information in the application.
Don’t create classes for concepts which:
- Are beyond the scope of the system;
- Refer to the system as a whole;
- Duplicate other classes;
- Are too vague or too specific (few instances);
Finding classes in other sources:
- Reviewing background information;
- Users and other stakeholders;
- Analysis patterns;
- CRC (Class Responsibility Collaboration) cards.
Class Diagram
In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the system’s classes, their attributes, operations (or methods), and the relationships among objects.
The class diagram is the main building block of object-oriented modeling. It is used for general conceptual modeling of the structure of the application, and for detailed modeling, translating the models into programming code. Class diagrams can also be used for data modeling.[1] The classes in a class diagram represent both the main elements, interactions in the application, and the classes to be programmed.
In the diagram, classes are represented with boxes that contain three compartments:
- The top compartment contains the name of the class. It is printed in bold and centered, and the first letter is capitalized.
- The middle compartment contains the attributes of the class. They are left-aligned and the first letter is lowercase.
- The bottom compartment contains the operations the class can execute. They are also left-aligned and the first letter is lowercase.
In the design of a system, a number of classes are identified and grouped together in a class diagram that helps to determine the static relations between them. In detailed modeling, the classes of the conceptual design are often split into subclasses.
In order to further describe the behavior of systems, these class diagrams can be complemented by a state diagram or UML state machine.
Object diagram
An object diagram in the Unified Modeling Language (UML), is a diagram that shows a complete or partial view of the structure of a modeled system at a specific time.
n the Unified Modeling Language (UML), an object diagram focuses on some particular set of objects and attributes, and the links between these instances. A correlated set of object diagrams provides insight into how an arbitrary view of a system is expected to evolve over time. In early UML specifications the object diagram is described as:
- “An object diagram is a graph of instances, including objects and data values. A static object diagram is an instance of a class diagram; it shows a snapshot of the detailed state of a system at a point in time. The use of object diagrams is fairly limited, namely to show examples of data structure.”
The latest UML 2.5 specification does not explicitly define object diagrams, but provides a notation for instances of classifiers.
Object diagrams and class diagrams are closely related and use almost identical notation. Both diagrams are meant to visualize static structure of a system. While class diagrams show classes, object diagrams display instances of classes (objects). Object diagrams are more concrete than class diagrams. They are often used to provide examples or act as test cases for class diagrams. Only aspects of current interest in a model are typically shown on an object diagram.