Lecture 4 Class Diagrams
Lecture 4 Class Diagrams
Information Systems
Department Lecture 4: Class Diagrams
Objectives
2
attributes
operations
1. Class
5. Constraint
Rules & 2. Attribute
Note
4. 3.
Relationship Operation
A property-string can be
Person
used to further describe an
attribute.
A property-string is written + name : String
# address : String [*]
within curly braces; it is a # birthdate : Date
comma-separated list of +date : Date = Current date
- ssn : Integer {readOnly}
property values that apply to
the attribute.
Eg: {readOnly}, {ordered},
and {sequence}
Person
+name : String
address : String
birthdate : Date
ssn : int
+eat(name:String):String{readOnly}
sleep()
work()
play()
13-Feb-16 Information Systems Department
4. Relationship
18
Association
Generalization
Dependency
Student Instructor
Instructors
Student Instructor
1..*
Student Instructor
1..*
Multiplicity
the number of objects that participate in the association.
Multiplicity Indicators
Exactly one 1
Zero or more (unlimited) * (0..*)
One or more 1..*
Zero or one (optional association) 0..1
Specified range 2..4
learn from
Student Instructor
teach
* drive *
Car company car driver Person
owns *
Person Car
prerequisite
Course
Engine
Car
Door
13-Feb-16 Information Systems Department
4.1 Association (cont.)
28
Scrollbar
1 1
Window Titlebar
1 1
Menu
1 1 .. *
Square
A sub-class may
Add attributes and operations
Add relationships
Refine (override) inherited operations
CourseSchedule
Course
add(c : Course)
remove(c : Course)
Customer
1 * may be
Order
canceled
id: long { value > 0 }
Constraint Note