Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Object Orientation
Encapsulation
Abstraction
Modularity
Hierarchy
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 4
What is Abstraction?
Salesperson
Not saying
Which
salesperson
just a
salesperson
in general!!!
Product
Customer
Manages Complexity
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 5
What is Encapsulation?
Hide implementation from clients
Clients depend on interface
Improves Resiliency
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 6
What is Modularity?
The breaking up of something complex into
manageable pieces
Order
Entry
Order Processing
System Order
Fulfillment
Billing
Manages Complexity
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 7
What is Hierarchy?
Levels of abstraction Asset
Increasing
abstraction
Truck
Conceptual entity
Chemical Process
: Professor
a + b = 10
ProfessorClark
Class Name Only
Professor Clark
ProfessorClark :
Professor Object Name Only
OO Principle: Abstraction
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 16
Sample Class
Class
Course
Properties Behavior
Name Add a student
Location Delete a student
a + b = 10
Days offered Get course roster
Credit hours Determine if it is full
Start time
End time
a + b = 10
Professor
Professor Clark
Professor
Professor Jones
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 21
Basic Concepts of Object Orientation
Object
Class
Attribute
Operation
Interface (Polymorphism)
Component
Package
Subsystem
Relationships
Object
Class
CourseOffering
Class
addStudent
deleteStudent
getStartTime
Operation getEndTime
Manufacturer B
Manufacturer A Manufacturer C
OO Principle:
Encapsulation
Shape Cube
Canonical Tube
(Class/Stereotype) <<interface>>
Representation Shape
Pyramid
Draw
Move
Scale
Rotate Cube
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 29
(stay tuned for realization relationships)
Basic Concepts of Object Orientation
Object
Class
Attribute
Operation
Interface (Polymorphism)
Component
Package
Subsystem
Relationships
OO Principle:
Package Name Modularity
Uses
Organize the model under development
A unit of configuration management
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 33
Basic Concepts of Object Orientation
Object
Class
Attribute
Operation
Interface (Polymorphism)
Component
Package
Subsystem
Relationships
<<subsystem>> Component
Component Name Name
Component Component
Interface Interface
Association
Role Names
Class University
Professor
Employee Employer
Student Schedule
Aggregation
Student Schedule
Aggregation
Multiplicity
Navigation
ClientPackage SupplierPackage
Dependency
relationship
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 45
Relationships: Generalization
A relationship among classes where one
class shares the structure and/or behavior
of one or more classes
Defines a hierarchy of abstractions in which
a subclass inherits from one or more
superclasses
Single inheritance
Multiple inheritance
Generalization is an is-a-kind of
relationship
Account
balance
name
Superclass number
(parent) Withdraw()
CreateStatement()
Generalization
Relationship
Checking Savings
Descendents
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 47
Example: Multiple Inheritance
A class can inherit from several other
classes
FlyingThing Animal
multiple
inheritance
GroundVehicle
owner Person
Superclass weight
(parent) licenseNumber 0..* 1
register( )
generalization
Sale
MyBoundaryClass
<<boundary>>
<<boundary>>
Sample boundary class (stereotype)
<<trace>> Stereotype of dependency relation
DesignClass Stereotype of <<Processor>>
<<Processor>>
Processor #1 Processor #1
PersistentClass
{persistence} anObject : ClassA
{location=server}
Member 1
Professor Department
1..*
{subset}
Department Head
1 1