Vous êtes sur la page 1sur 24

Introduction to

Object Orientation

30/09/2006 SE6161 – Analisis Perangkat Lunak Slide 1


Objectives: Introduction to
Object Orientation
„ Understand the basic principles of object
orientation
„ Define the basic concepts and terms of
object orientation
„ Discuss the strengths of object orientation

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 2


Introduction to Object
Orientation Topics
„ Basic Principles of Object Orientation
„ Basic Concepts of Object Orientation

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 3


Basic Principles of Object
Orientation
Object Orientation

Encapsulation
Abstraction

Modularity

Hierarchy
30/09/2006 SE6161 Analisis Perangkat Lunak Slide 4
What is Abstraction?
Salesperson

Customer

Product

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 5


What is Encapsulation?
„ Hide implementation from clients
… Clients depend on interface

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 6


What is Modularity?
„ The breaking up of something complex
into manageable pieces
Order
Order Entry
Order Processing Fulfillment
System

Billing

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 7


What is Hierarchy?
… Levels of abstraction
Increasing Asset
abstraction

BankAccount Security RealEstate

Savings Checking Stock Bond

Decreasing
Classes at the same level of the hierarchy
abstraction
should be at the same level of abstraction
30/09/2006 SE6161 Analisis Perangkat Lunak Slide 8
Introduction to Object
Orientation Topics
„ Basic Principles of Object Orientation
„ Basic Concepts of Object Orientation

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 9


Basic Concepts of Object
Orientation
„ Object
„ Class
„ Attribute
„ Operation
„ Component
„ Generalization
„ Polymorphism

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 10


What is an Object?
English 101
„ Behavior
„ State Intro to OO 180
Geology 110

„ Unique identity World History 200


Geology 110

Algebra 110
Music History 200

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 11


What is a Class?
„ An object is defined by a class
English 101

Intro to OO 180
Geology 110

CourseOffering World History 200


Geology 110

Algebra 110
Music History 200

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 12


What is an Attribute?
Object
Class

Attribute Attribute Value


:CourseOffering
number = 101
startTime = 900
CourseOffering endTime = 1100
number
startTime
endTime :CourseOffering
Name = 104
startTime = 1300
endTime = 1500

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 13


What is an Operation?
CourseOffering
Class
addStudent
deleteStudent
getStartTime
Operation getEndTime

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 14


What Is A Component?
„ A non-trivial, nearly independent, and
replaceable part of a system that fulfills a clear
function in the context of a well-defined
architecture
Design Model Implementation Model

<<subsystem>> Component
Component Name Name
Component Component
Interface Interface

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 15


What is Generalization?
„ One class inherits from another
GroundVehicle
owner Person
ancestor weight
licenseNumber 0..* 1

register( )
generalization

Car Truck Trailer


decendent size tonnage
getTax( )

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 16


What is Polymorphism?
„ The ability to hide many different
implementations behind a single interface

Manufactor A
Manufactor A Manufactor C

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 17


Strengths of Object Orientation
„ A single paradigm
… Single language used by users, analysts, designers,
implementers
„ Facilitates architectural and code reuse
„ Models more closely reflect the real world
… More accurately describe corporate data and processes
… Decomposed based on natural partitioning
… Easier to understand and maintain

„ Stability
…A small change in requirements does not mean massive
changes in the system under development
30/09/2006 SE6161 Analisis Perangkat Lunak Slide 18
A Simple Sales Order Example
Order

Product

Ship via

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 19


Class Diagram for the Sales
Example
Sale

Salesperson Customer Product Vehicle

Corporate Individual Truck Train

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 20


Effect of Requirements Change
Sale
Suppose the requirements
for shipping by a truck
change ...

Salesperson Customer Product Vehicle

Corporate Individual Truck Train

Only the Truck class changes


30/09/2006 SE6161 Analisis Perangkat Lunak Slide 21
Introduction to Object
Orientation Topics
„ Basic Principles of Object Orientation
„ Basic Concepts of Object Orientation

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 22


Review: Introduction to Object Orientation

„ What are the four basic principles of object


orientation? Provide a brief description of each.
„ What is an Object and what is a Class? What is the
difference between them?
„ What is an Attribute?
„ What is an Operation?
„ What is generalization?
„ What is polymorphism?
„ Describe the strengths of object orientation.
SE6161 Analisis Perangkat Lunak Slide 23
30/09/2006
REFERENCES
OOAD Using the UML - Introduction to Object Orientation, v 4.0
Copyright  1994-1998 Rational Software, all rights reserved

30/09/2006 SE6161 Analisis Perangkat Lunak Slide 24

Vous aimerez peut-être aussi