Professional Documents
Culture Documents
an overview
Unified Modeling
Specification Language
and Analysis (UML): an overview,
of Information Systems Session 3 Spring 2005 3
The Class Diagram
• The Class diagram is the primary diagram for code generation and
for reverse engineering
• The Class diagram shows the structure of data, the relationships
between data and the operations applied on data (behavior)
• Diagram creation often reveals:
– Missing data
– Missing relationships
– Conflicting data or relationships
– Incorrect relationships
– Poor partitioning of data
– Faulty assumptions
– Redundant information
– Ways data can become corrupted
Package diagram
A"
em
st
sy
-To simplify complex class diagrams, we can group classes
ub
"S
ed
into Packages
m
na
- Packages appear as rectangles with small tabs at the top
ge
a
-The package name is on the tab or inside the rectangles
ck
pa
-The dotted arrows are dependencies
L
UM
- serialNumber
- name
# price
+ buy()
• An attribute is a property of a class + display()
- swap(x:int,y: int)
Produt Order
serialNumber orderID
name * * date
price includes
checkout()
buy() addProduct(Product p)
display() clearAll()
serialNumber orderID
name * * date
price includes
checkout()
buy() addProduct(Product p)
display() clearAll()
Unified Modeling
Specification Language
and Analysis (UML): an overview,
of Information Systems Session 3 Spring 2005 14
Object diagrams
Produt Order
serialNumber orderID
name * * date
price
checkout()
buy() addProduct(Product p)
display() clearAll()
OrderItem
According to the
An association class is requirements, each
a “normal” class, and numberOfProducts : int
giftWrap : boolean product can appear is
may include relations, several orders, and each
addAnother()
inheritance etc. removeOne() order may include
several products
Links should be
verified, according
to the association
multiplicity
For each link, an
association class
instance should be
declared
Worker * 1..* *
Person Company
employee employer
employs
0..1
Manages Manager
Accounting
SecurityControl
System
<<creates>> <<modifies>>
AccountingSystem
creates a Receipt
object Reciept Order
– Define hierarchies
• Reuse Button Image
ImageButton
Overriding
Multiple clickImage()
Inheritance
updateName(...)
What’s the updateDesc(...)
problem
here?
Category
name : String
importance : int
Resource
ID and name User Interface
includes }
* *
CategorizedResource Category
* *
getCategory() : name : String
Category importance : int
Word Processing
Document
Author
fileName
Permission
*
*
* Picture
Folder
name
Window
Operating
System
close()
move()
0..2 1
34
Class Diagram Guidelines
All properties must have a final number of values
Book
Book
systemNumber : long
title : String systemNumber : long
author : String title : String
orderOfAuthor : int author : String * Category
*
category : String[] orderOfAuthor : int categorized
copyNumber : long copyNumber : int name : String
holderName : String holderName : String
returnDate : Date returnDate : Date
location : String location : String
courseId : String courseId : String
courseName : String courseName : String
The number of
categories for a
book is unbounded
35
Class Diagram Guidelines
All properties must depend on the whole
class essence, and not just a part of it
Order
Author
orderOfAuthor : int 1..*
Book name : String
systemNumber : long
title : String written by
author : String * Category
*
orderOfAuthor : int categorized * Category
copyNumber : int Book name : String *
holderName : String categorized name : String
systemNumber : long *
returnDate : Date title : String
location : String courseId : String
courseId : String courseName : String
courseName : String location : String
1..*
Has Copy
copyNumber : int
holderName : String
returnDate : Date
location : String
36
Class Diagram Guidelines
All properties must depend only on the class’s
essence
Order Order
Author Author
orderOfAuthor : int orderOfAuthor : int
1..* 1..*
name : String name : String
37
Applying the Class diagram on the Case study
– نريد تصميم نظام للتحكم بقائمة محتويات مستودع حيث يتم تسجيل معلومات
خاصة بالمنتجات المخزنة في المستودع وبالمنتجات المشحونة منه .بعد استالم
المنتجات المشتراة من البائعين وتخزينها في المستودع ,يتم بيعها كما وردت أو
يتم تجميع عدة منتجات مع بعضها البعض لتباع على شكل منتج خاص
بالمستودع
39
Building an Object diagram for the Case study
Before
After
Unified Modeling
Specification Language
and Analysis (UML): an overview,
of Information Systems Session 3 Spring 2005 46
Diagrams in UML
A Diagram is the graphical presentation of a set of elements.
UML includes 9 principal diagrams:
1. Class and object diagrams are static model
1. Class Diagram views. Interaction diagrams are dynamic.
2. Object Diagram They describe how objects collaborate.
From Scenario 1
Scenario 2
Questions ?