Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: Class Diagram
Description: Class Diagram, system sequence diagram, data flow diagram.

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


CLASS
Diagrams

imran khattak
BSCS
FUUAST ISLAMABAD

CLASS DIAGRAM

Classes
ClassName

A class is a description of a set of
objects that share the same attributes,
operations, relationships, and semantics
...


Class Names
ClassName

attributes

operations

The name of the class is the only required
tag in the graphical representation of a
class
...


Class Attributes
Person
name
: String
address : Address
birthdate : Date
ssn
: Id

An attribute is a named property of a
class that describes the object being modeled
...


Class Attributes (Cont’d)
Attributes are usually listed in the form:
Person

name
: String
address : Address
birthdate : Date
/ age
: Date
ssn
: Id

attributeName : Type

A derived attribute is one that can be
computed from other attributes, but
doesn’t actually exist
...
A derived attribute is
designated by a preceding ‘/’ as in:
/ age : Date

Class Attributes (Cont’d)
Person

+ name
: String
# address : Address
# birthdate : Date
/ age
: Date
- ssn
: Id

Attributes can be:
+ public
# protected
- private
/ derived

Class Operations
Person
name
: String
address : Address
birthdate : Date
ssn
: Id

eat
sleep
work
play

Operations describe the class behavior
and appear in the third compartment
...


Depicting Classes
When drawing a class, you needn’t show attributes and operation
in every diagram
...


A responsibility is a contract or obligation of a class to perform
a particular service
...


-- indicate battery state

Relationships
In UML, object interconnections (logical or physical), are
modeled as relationships
...
The dependency from CourseSchedule to
Course exists because Course is used in both the add and
remove operations of CourseSchedule
...
It denotes an
inheritance of attributes and behavior
from the superclass to the subclass and
indicates a specialization in the subclass
of the more general superclass
...
g
...

Student

Employee

TeachingAssistant

Association Relationships
If two classes in a model need to communicate with each other,
there must be link between them
...


Student

Instructor

Association Relationships (Cont’d)
We can indicate the multiplicity of an association by adding
multiplicity adornments to the line denoting the association
...
*

Instructor

Association Relationships (Cont’d)
The example indicates that every Instructor has one or more
Students:

Student

1
...
e
...


Student

teaches
1
...
*

Instructor

Association Relationships (Cont’d)
We can also name the association
...
*

1
...


member of
Student

1
...
*
president of

1
...
Here, a Router object requests
services from a DNS object by sending messages to (invoking
the operations of) the server
...


Router

DomainNameServer

Association Relationships (Cont’d)
Associations can also be objects themselves, called link classes
or an association classes
...


next
LinkedListNode

previous

Association Relationships (Cont’d)
We can model objects that contain other objects by way of
special associations called aggregations and compositions
...
Aggregations are
denoted by a hollow-diamond adornment on the association
...
e
...
Compositions are denoted by a filled-diamond
adornment on the association
...
*

Example 1: University Courses
Some instructors are professors, while
others have job title adjunct
 Departments offer many courses, but a
course may be offered by >1 department
 Courses are taught by instructors, who
may teach up to three courses
 Instructors are assigned to one (or more)
departments
 One instructor also serves a department
chair


Class Diagram for Univ
...
1

Department
1
...
*

1
...
*
0
...
Rep
...
*
Employee

1
...
*

+name : string

+name : string
+status : enum

1
1
Responsible For
0
...
n

1
1

0
...
n

History Entry
-when : Date
-whatDone : string

Code Bug Report

Example from Fowler

Objects, Object Diagrams





Objects drawn like
classes, but names
for all instances
underlined
Objects may be
“anonymous”
Attributes are
given values

Class Attributes, Operations


Recall in Java and C++ you may have class
attributes and class operations
◦ keyword static used

◦ One attribute for all members of class
◦ An operation not encapsulated in each object,
but “defined in” that class’ scope


In UML class diagrams, list these in the
class box’s compartments, but underline
them


Title: Class Diagram
Description: Class Diagram, system sequence diagram, data flow diagram.