You are on page 1of 48

Class diagrams do not show temporal information

Collection of static modeling elements such as


classes and their relationships connected as a graph
to each other and to their contents.

Shows the static structure of the model.

Also referred to as Object Modeling

UML Class Diagram

A class is drawn as a rectangle with


three components separated by
horizontal lines.

Class Notation : static structure

Binary Association Notation

n-ary association

Association Class

Xor Association

Association Navigation

A qualifier is an attribute or list of attributes of the


association whose values serve to partition the set
of objects associated with an object across an
association.
Optional

Qualifier

Multiplicity

Form of association.

Aggregation and Composition

Composition

Generalization is displayed as directed line


with a closed, hollow arrowhead at the super
class end.

Generalization is the relationship between a


more general class and more specific class.

Generalization

Generalization

Generalization

Realization Between class and interface.

Dependency When one class requires


another class object or specific method
Client supplier relationship

Other kinds of association are:

Association

Dependency Relationship

Common Mechanisms

Notes

Other Adornments

Specify author and version of component

Properties relevant to code generation or configuration


management.

Tagged Values

Modeling Comments

Common Modeling Techniques

Modeling New Properties

Manager must be a member of department for atleast


one year.

Modeling New Semantics

3. To model a logical database schema.

2. To model simple collaborations

1. To model the vocabulary of a system

Class diagram is used in one of three ways:

Good balance of responsibilities.

Identify the relationships.

For each mechanism, identify the classes,


interfaces and other collaborations that
participate.

Identify the mechanism to be modeled.

Modeling simple collaboration

Modeling Simple Collaborations

No attributes or operations are shown for PathAgent, although its


responsibilities are given

The class PathAgent has a onetoone association to Driver and a one


tomany association to CollisionSensor.

Both of these classes inherit the five operations of their parent, Motor.
The two classes are, in turn, shown as parts of another class, Driver.

One abstract class (Motor) with two concrete children,


SteeringMotor and MainMotor.

The figure focuses on the classes involved in the mechanism for


moving the robot along a path.

Modeling Primitive Types

Watch for common patterns that complicate


physical database design, cyclic association, one
toone association and nary associations.
Use tools to transform logical design into physical
design

Expand structural details of these classes.

Create a class diagram that contain these classes


and mark them persistent.

Identify those classes whose state must transcend


over lifetime.

Class diagrams commonly contain the following


things:
Classes
Interfaces
Dependency, generalization, and association
relationships
Like all other diagrams, class diagrams may
contain notes and constraints.

Choosing right kind of classifier.

Different kinds of classes.

Special properties of attributes and operations.

Classifiers

Advanced Classes

Advanced Classes

Classifiers include
Classes
Interfaces
Datatypes
Signals
Components
Nodes
Use cases
Subsystems

A type whose values have no identity, including


primitive builtin types (such as numbers and
strings), as well as enumeration types (such as
Boolean)

Datatype

A collection of operations that are used to specify


a service of a class or a component

Interface

A physical and replaceable part of a system that


conforms to and provides the
realization of a set of interfaces

Component

The specification of an asynchronous stimulus


communicated between instances

Signal

A description of a set of a sequence of actions,


including variants, that a system performs that
yields an observable result of value to a particular
actor.

Node
A physical element that exists at run time and that
represents a computational resource, generally
having at least some memory and often processing
capability.
Use case

A grouping of elements of which some constitute a


specification of the behavior offered by the other
contained elements.

Subsystem

Classifiers

protected
Any descendant of the classifier can use the
feature;
specified by prepending the symbol #

public
Any outside classifier with visibility to the given
classifier can use the feature;
specified by prepending the symbol +

Visibility

Private
Only the classifier itself can use the feature;
specified by prepending the symbol

Visibility

A concrete class (such as Button and OKButton) is


one that may have direct instances.

classes are abstract meaning that they may not


have any direct instances.

A class is specified as abstract by writing its name


in italics.

Abstract operations map to pure virtual


operations.

Multiplicity

There are three defined properties that you can


use with attributes.
1.changeable
There are no restrictions on modifying the
attribute's value.
2. addOnly
For attributes with a multiplicity greater than one,
additional values may be
added, but once created, a value may not be
removed or altered.

3. frozen The attribute's value may not be changed


after the object is initialized.

You might also like