Professional Documents
Culture Documents
DIAGRAMS
1
Definitions
Philosophy:
Contents:
Class diagrams commonly contain the following things:
● Classes
● Interfaces
● Collaborations
● Dependency, Generalization, and association relationships.
Class diagrams also contain notes and constraints for comments.
Class diagrams also contain packages or subsystems used to group things
3
Construction of a Class Diagram
6. Add attributes and operations to provide the functionality required in the class diagram.
7. Detail all the operations and attributes giving them data types and parameters.
4
Company
1..* 1..*
Department Office
name : Name Location
Address : String
0..1
Voice : Number
* *
{subset}
member manager
1..* 1
Person HeadQuarters
ContactInformation
Name : Name address : String
employeeID : Integer
title :String
You use class diagrams to model the static design view of a system.
Modeling Techniques
1. Modeling simple collaborations: A collaboration is society of classes, interfaces and
other elements that work together. Every class is in collaboration with other class. To visualize ,
specify , construct and document the collaborations , use class diagram as follows
6
Example
Path Agent 1 *
Collision Sensor
Responsibilities
--seek path
--Avoid obstacles 1 1 Driver
Motor
Move(d:direction,s:speed)
Stop()
resetCounter()
Status status()
7
2. Modeling a logical Database Schema: The UML is most suitable to model logical
database and physical database schemas. In relational database models the E-R diagrams
plays a vital role to model relational databases. Class diagrams are use to model the behavior
of a system.
8
School Modeling a schema
{persistent}
Department
name : Name 0..1
{persistent}
address : String
phone : Number 1..*
name : Name
addStudent() has
addInstructor ()
removeStudent()
getStudent()
1 1..* removeInstructor ()
getInstructor ()
getAllStudents()
getAllInstructor s()
addDepartment()
1..*
removeDepartment ()
getDepartment () 1..*
getAllDepartments()
Assigned to 0..1
1..*
1..*
1 ..* Chairperson
Course
Student Instructor
{persistent}
{persistent} * attends * {persistent}
name : Name
studentID : Number name : Name Teaches
courseID : Number
* 1..* name : Name
Forward and Reverse Engineering
10
successor
EventHandler
{java}
Client
{java} - currentEventID : Integer
- source : Strings
handleRequest() : void
GUIEventHandler
{java}
11
Reverse engineering is the process of transforming code into a
model through a mapping from a specific implementation language.
Reverse engineering provides good information but is incomplete.
12
Points to Remember for construction
13
Object Diagrams
● Objects
● Links
Like all other diagrams, object diagrams may contain notes, constraints,
packages, and subsystems.
Uses
● Object diagrams are used to model object structures.
14
Object Diagram
c:Company
d1:Department d2 : Department
d3: Department
manager
p: Person
: ContactInformation
name = “Rocky”
employeeID = 2467 address = “1472 Downtown”
Title = “VP of Sales”
15
Modeling object structures: (construction)
16
r: Robot
[moving]
w: world <<global>>
:Element
Unassigned
a1 : Area a2 : Area
17
Forward and Reverse Engineering :
18
Points to remember for construction
19