Académique Documents
Professionnel Documents
Culture Documents
Using UML
CS 3331
Fall 2007
Object-Oriented Modeling
Conceptual/computational world
Real world
Abstraction
Interpretation
Data-oriented
Object-oriented
Abstraction
Encapsulation
Relationship
Object-oriented
= object (class) + inheritance + message send
Representation in the
Model
Object
An object represents
anything in the real world
that can be distinctly
identified.
Class
Identity
State
Behavior
The type consists of the return type and the list of parameter
types of the method, often called signature.
The value is the implementation of the method often
expressed as a sequence of statements, in languages like
Java and C++.
Class
Static model
Dynamic model
representing classes
Links representing of relationships among
classes
Inheritance
Association, including aggregation and
composition
Dependency
fieldn
method1
methodn
10
Example
Point
x
y
Point
move
Point
- x: int
- y: int
+ move(dx: int, dy: int): void
11
Field declarations
birthday: Date
+duration: int = 100
-students[1..MAX_SIZE]: Student
Method declarations
+move(dx: int, dy: int): void
+getSize(): int
Visibility
Notation
public
protected
package
private
12
Exercise
13
fieldn = valuen
p1:Point
p2:Point
x = 10
y = 20
x = 20
y = 30
14
<<interface>>
Drawable
Drawable
+ draw(g: Graphics): void
15
Inheritance in Java
16
Inheritance in UML
Superinterface
Interface
Subclass
Subinterface
Class
extension of
classes
extension of
interfaces
implementation
of interfaces
17
Interpretation
18
Example
Student
{abstract}
Nondegree
Undergraduate
Master
Graduate
{abstract}
PhD
19
Exercise
20
Association
Student
Course
21
Association (Cont.)
Student
enroll
Course
22
Association (Cont.)
Student
enroll
Course
23
Association (Cont.)
Student
0..*
advisee
1
advisor
Faculty
24
Example
Student
6..*
enroll
0..*
Course
1..*
advisee 0..*
teach
1
advisor
1
Faculty
25
Exercise
26
Aggregation
Aggregate
Component
27
Composition
Composition
Component
28
Example
University
1
1..*
College
1..*
Department
0..*
Student
member-of
chair-of
1..*
1
Faculty
29
Dependency
Class1
<<use>>
Class2
30
Example
Registrar
+ addCourse(s: CourseSchedue, c: Course): void
+ removeCourse(s: CourseSchedue, c: Course): void
+ findCourse(title: String): Course
+ enroll(c: Course, s: Student): void
+ drop(c: Course, s: Student): void
CourseSchedule
Course
Student
Dependencies are most often omitted from the diagram unless they
convey some significant information.
31
32