Download - Cn if2261 intro tooo
1
Page 1
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 1
R
Introduction to Object Orientation
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 2
R
Objectives: Introduction to Object Orientation
w Understand the basic principles of object orientation w Define the basic concepts and terms of object orientationw Discuss the strengths of object orientation w Understand some basic UML modeling mechanisms
2
Page 2
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 3
R
Introduction to Object Orientation Topics
w Basic Principles of Object Orientationw Basic Concepts of Object Orientationw General UML Modeling Mechanisms
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 4
R
Basic Principles of Object Orientation
Object Orientation
Enca
psul
atio
n
Abst
ract
ion
Hier
arch
y
Mod
ular
ity
3
Page 3
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 5
R
What is Abstraction?
Customer
Salesperson
Product
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 6
R
What is Encapsulation?
w Hide implementation from clients§ Clients depend on interface
4
Page 4
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 7
R
What is Modularity?
w The breaking up of something complex into manageable pieces
Order Processing System
Billing
OrderEntry
OrderFulfillment
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 8
R
What is Hierarchy?
Decreasing abstraction
Increasing abstraction
Asset
RealEstate
Savings
BankAccount
Checking Stock
Security
Bond
Classes at the same level of the hierarchy should be at the same level of abstraction
w Levels of abstraction
5
Page 5
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 9
R
Introduction to Object Orientation Topics
w Basic Principles of Object Orientationw Basic Concepts of Object Orientationw General UML Modeling Mechanisms
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 10
R
Basic Concepts of Object Orientation
w Objectw Classw Attributew Operationw Componentw Generalizationw Polymorphism
6
Page 6
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 11
R
What is an Object?
w Behaviorw Statew Unique identity
English 101
Geology 110
Geology 110World History 200
Algebra 110Music History 200
Intro to OO 180
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 12
R
What is a Class?
w An object is defined by a class
English 101
Geology 110
Geology 110World History 200
Algebra 110Music History 200
Intro to OO 180
CourseOffering
7
Page 7
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 13
R
What is an Attribute?
:CourseOfferingnumber = 101startTime = 900endTime = 1100
:CourseOfferingName = 104startTime = 1300endTime = 1500
CourseOfferingnumberstartTime endTime
Class
Attribute
Object
Attribute Value
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 14
R
What is an Operation?
CourseOffering
addStudent deleteStudentgetStartTimegetEndTime
Class
Operation
8
Page 8
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 15
R
w A non-trivial, nearly independent, and replaceable part of a system that fulfills a clear function in the context of a well-defined architecture
<<subsystem>>Component Name
ComponentName
What Is A Component?
Design Model Implementation Model
Component Interface
Component Interface
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 16
R
What is Generalization?
w One class inherits from another
Truck
tonnage
GroundVehicle
weightlicenseNumber
Car
owner
register( )
getTax( )
Person
0..*
Trailer
1ancestor
decendent
generalization
size
9
Page 9
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 17
R
What is Polymorphism?
w The ability to hide many different implementations behind a single interface
Manufactor AManufactor A
Manufactor C
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 18
R
Strengths of Object Orientation
w A single paradigm§ Single language used by users, analysts, designers,
implementersw Facilitates architectural and code reusew Models more closely reflect the real world§ More accurately describe corporate data and processes§ Decomposed based on natural partitioning§ Easier to understand and maintain
w Stability§ A small change in requirements does not mean massive
changes in the system under development
10
Page 10
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 19
R
A Simple Sales Order Example
Order
Product
Ship via
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 20
R
Class Diagram for the Sales Example
Salesperson Product
Sale
Corporate
Customer
Individual Truck
Vehicle
Train
11
Page 11
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 21
R
Effect of Requirements Change
Only the Truck class changes
Suppose the requirementsfor shipping by a truckchange ...
Salesperson Product
Sale
Corporate
Customer
Individual Truck
Vehicle
Train
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 22
R
Introduction to Object Orientation Topics
w Basic Principles of Object Orientationw Basic Concepts of Object Orientationw General UML Modeling Mechanisms
12
Page 12
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 23
R
Stereotypes
w Define a new model element in terms of another model element
w May be applied to all modeling elements
<<boundary>>
<<boundary>>
<<trace>>
Processor #1<<Processor>>
DesignClass
Processor #1
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 24
R
Properties
w A property, or specific attribute, of a UML elementw Also called tagged valuesw Some properties are defined by UML§ Persistence§ Location (e.g., client, server)
w Properties can be created by UML modelers for any purpose
PersistentClass{persistence} anObject : ClassA
{location=server}
13
Page 13
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 25
R
Notes
w A note can be added to any UML elementw It is a ‘dog eared’ rectangle w The note may be anchored to an element with a dashed line
There can be up to one MaintainScheduleForm per user session.MaintainScheduleForm
OOAD Using the UML - Introduction to Object Orientation, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 26
R
Review: Introduction to Object Orientation
w What are the four basic principles of object orientation? Provide a brief description of each.
w What is an Object and what is a Class? What is the difference between them?
w What is an Attribute?w What is an Operation?w What is generalization? w What is polymorphism? w Describe the strengths of object orientation.w Name and describe 3 general UML mechanisms.