Object-Oriented Development

54
Object-Oriented Development By Grady Booch

description

Object-Oriented Development. By Grady Booch. Abstract. Object-oriented development is a partial-lifecycle software development method which the decomposition of a system is based on the concept of an object - PowerPoint PPT Presentation

Transcript of Object-Oriented Development

Page 1: Object-Oriented Development

Object-Oriented Development

By

Grady Booch

Page 2: Object-Oriented Development

Abstract

• Object-oriented development is a partial-lifecycle software development method which the decomposition of a system is based on the concept of an object

• This method is fundamentally different than Traditional functional approaches to design

Page 3: Object-Oriented Development

Abstract continues…

• Serves to help manage the complexity of massive software-intensive systems

Page 4: Object-Oriented Development

Introduction

• Object-oriented programming is what structured programming was in 1970’s

• Object-oriented approach to software design in which the decomposition of a system is based upon the concept on an object

Page 5: Object-Oriented Development

Continued…

• An object is an entity whose behavior is characterized by the action that it suffers and that requires of other objects

• Object oriented development is different than traditional functional methods

Page 6: Object-Oriented Development

Functional method

• Fortran, Cobol, Pascal

• Each module represents a major step in the overall process

• Tend to consist of collections of programs, because they are the only building blocks available

Page 7: Object-Oriented Development

Continued…

• Subroutines are not well suited to the description of abstract objects. This is a serious drawback

Page 8: Object-Oriented Development

Object-oriented method

• Ada and Smalltalk

• subprogram as an elementary building block

• In Ada, Package and task are major elements

• Package is used to create new objects and classes of objects

Page 9: Object-Oriented Development

Continued…

• Task express concurrent objects and activities in a natural way

• Package and subprograms help to better build abstraction of the problem space

• By permitting a more balanced treatment between nouns and verbs

Page 10: Object-Oriented Development

Nouns and Verbs

• Nouns are objects

• Verbs are operations

Page 11: Object-Oriented Development

functional method Limitations

• Do not effectively address data abstraction and information hiding

• Generally inadequate for problem domains with natural concurrency

• Often not responsive to changes in the problem space

• OO approach mitigate these problems

Page 12: Object-Oriented Development

A cruise control design

• Inputs to the system– System on/off

• If on, cruise control maintains the speed

– Engine on/off• Cruise control only active if engine is on

– Pulse from wheel• One pulse for every revolution

– Accelerator• How far it has been pressed

Page 13: Object-Oriented Development

Continued…

– Brake• when pressed, cruise control is turned off

– Increase/Decrease Speed• If only the cruise control system is on

– Resume• Resume the last maintained speed

– Clock• Timing pulse every millisecond

Page 14: Object-Oriented Development

Continued…

• Output from the system– Throttle

• Digital value for the engine throttle setting

Page 15: Object-Oriented Development

Cruise Control Hardware Block Diagram

System on/off

Engine on/off

Pulse from Wheel

Accelerator

Brake

Increase/decrease speed

Resume speed

Clock

Cruise-

Control

System

Throttle

Page 16: Object-Oriented Development

Wheel

Clock

Driver

Brake

Engine

Accel

Calculate CurrentSpeed

Calculate DesiredSpeed

Set BrakeState

Calculate ThrottleSetting

Current speed

Desired speed

Throttle Setting

Brake State

Current speed

Desired speed

Brake State

Pulse

Clock tick

On/Off

Incr/Decr

Resume

On/Off

On/Off

Value

Throttle Setting

Throttle

Brake State

Current Speed

Desired speed

Page 17: Object-Oriented Development

GetDesiredSpeed

CruiseControlSystem

GetCurrentSpeed

GetBrakeState

Calculate

ThrottleSetting

PutThrottleValue

Functional Decomposition

Page 18: Object-Oriented Development

Driver

Brake

Clock Wheel

Engine

Accelerator

Desired

Speed

Current

Speed

Throttle

Object Oriented

Decomposition

Page 19: Object-Oriented Development

Object-Oriented Development

• Major steps in Object-oriented development– Identify the objects and their attributes– Identify the operations suffered by and required

of each object– Establish the visibility of each object in relation

to other objects– Establish the interface of each object– Implement each object

Page 20: Object-Oriented Development

Identify the objects and their attributes

• Recognition of major actors, agents, and servers in the problem space plus their role in our model of reality

• The objects identify is this step derive from the nouns used in describing the problem space

• Establish classes of objects for similar objects

Page 21: Object-Oriented Development

Identify the operations suffered by and required of each object

• Serves to characterize the behavior of eahc object or class of objects

• Establish the static semantics of the object by determining the operations that may be meaningfully performed on the object of objects

• Establish the dynamic behavior of object by identifying the constraints upon time or space that must be observed

Page 22: Object-Oriented Development

Establish the visibility of each object in relation to other objects

• We identify the static dependencies among objects and classes of objects

• In other words, what objects see and are seen by a given objects

• The purpose of this step is to capture the topology of objects from our model of reality

Page 23: Object-Oriented Development

Establish the interface of each object

• Produce a module specification, using some suitable notation (Ada, Smalltalk, etc, …)

• This captures the static semantics of each object or class of objects that we established in previous step

• This specification serves as a contract between the clients of an object and the object itself

• In other words, the interface forms the boundary between the outside view and the inside view of an object

Page 24: Object-Oriented Development

Implement each object• Involves choosing a suitable representation

for each object or class of objects

• Implementing the interface from previous step

• Involves decomposition or composition if and object is found to consist of several objects

• In this case we repeat our method to further decompose the object

Page 25: Object-Oriented Development

• Object-oriented development is a partial-lifecycle method

• It focuses upon the design and implementation stages of software development

• It is necessary to couple object-oriented development with appropriate requirements and analysis methods in order to help create or model of reality

Page 26: Object-Oriented Development

Major Goals in developing object Based software

• To reduce the total life-cycle software cost by increasing programmer productivity and reducing maintenance cost

• Implement software system that resist both accidental and malicious corruption attempts

Page 27: Object-Oriented Development

Properties of an Object

• Object is an entity that – Has state

– Is characterized by the actions that it suffers and that it requires of other objects

– Is an instance of some class

– Is denoted by a name

– Has restricted visibility of and by other objects

– May be viewed either by its specification or by its implementation

Page 28: Object-Oriented Development

Object Classification

• Actor– Suffers no operation but only operates upon

other objects

• Agent– Serves to perform some operation on behalf of

another object and in turn may operate upon another object

• Server– Suffers operation and may not operate upon

other objects

Page 29: Object-Oriented Development

Class

• An object is a unique instance of some class

• A class denotes a set of similar but unique objects

• Class serves to factor the common properties of a set of objects and specify the behavior of all instances

Page 30: Object-Oriented Development

Inheritance

• Permits a hierarchy of classes

• All objects are an instance of a class, which is a subclass of another class (and so on)

• Subclass has the same operations defined by the superclass

• May also add operation, modify existing operation, and hide operation from the superclass

Page 31: Object-Oriented Development

Two views to each Objects

• Outside View– Serves to capture the abstract behavior of the

object– An object can interact with other objects by just

knowing its outside view– Implementation does not need to be present for

interaction with the object

• Inside View– Indicates how the behavior is implemented and it

is hidden form other objects

Page 32: Object-Oriented Development

Ada and Object-Oriented Development

• Classes of objects are denoted by packages that export private or limited private types

• Objects are denoted by instances of private or limited private types or as packages that serve as abstract state machined

• Objects state resides either with a declared object or in the body of a package

Page 33: Object-Oriented Development

Continued …• Operations are implemented as subprograms

exported from a package specification; generic formal subprogram parameters serve to specify the operations required by an object

• Visibility is statistically defined through unit context clauses

• Separate compilation of package specification and body support the tow views of an object

• Tasks and task types may be used to denote actor objects and classes of objects

Page 34: Object-Oriented Development

Type

Operation

Operation

Object

Object

Object

Name_A

Name_B

Name_XName_Y

Package

Names, Objects and ClassesInteraction of the points in the previous slide

Page 35: Object-Oriented Development

Symbols of OODTask

Generic Package

Generic Subprogram

Package Subprogram

Subsystem

Object

Page 36: Object-Oriented Development

• These symbols can be connected by a direct line

• A line connects object A to B, this denotes object A depends on object B

Page 37: Object-Oriented Development

Design Case Study• A collection of free-floating Buoys• Buoys collect air and water temperature• Collect wind speed• Collect location data through variety of

sensors• Each equipped with a radio transmitter to

broadcast weather and location in formation as well as an SOS message

• Each equipped with a radio receiver to receive requests from passing vessels

Page 38: Object-Oriented Development

• Some equipped with a red light, which may be activated by vessel during a sea-search operations

• If a sailor is able to reach the buoy, he or she may flip a switch on the side to initiate an SOS broadcast

Page 39: Object-Oriented Development

Buoys

Page 40: Object-Oriented Development

Software Requirements

• Maintain current current wind temperature, and location in formation; wind speed readings are taken every 30 seconds; temperature readings every 10 seconds and location every 10 seconds; wind and temperature; wind and temperature values kept as a running average

• Broadcast current wind, temperature and location information every 60 seconds

Page 41: Object-Oriented Development

• Broadcast wind, temperature, and location information from the past 24 hours in response to requests from passing vessels

• Activate or deactivate the red light based on a request from a passing vessel

• Continuously broadcast an SOS signal after a sailor engages the emergency switch; this takes priority over all other broadcast and continues until reset by a passing vessel

Page 42: Object-Oriented Development

Clock

Emergency Switch

RadioTransmitter

RedLight

RadioReceiver

LocationSensor

WaterTemp

Sensor

AirTemp

Sensor

WindSpeedSensor

Set LightState

BroadcastMessage

CalculateLocation

CalculateAverage

CalculateAverage

CalculateAverage

State

State

Pulse

Pulse

Avg. value

Value

Avg. value

Avg. value

value

Value

Value

Value

SOS Request

SOS Message

Wind/Location Data

Sensor Data Bases

Request

Host at see Buoy data flow diagram

Page 43: Object-Oriented Development

Objects• Clock

– Provides the stimulus for periodic actions

• Wind Speed sensor– Maintains a running average of wind speed

• Air Temperature Sensor– Maintains a running average of air temperature

• Water Temperature Sensor– Maintains a running avg. of water temperature

• Location Sensor– Maintains the current buoy location

• Sensor Database– Serves to store weather and location history

Page 44: Object-Oriented Development

• Radio Receiver– Provides a channel for requests from passing vessels

• Radio Transmitter– Provides a channel for broad cast of weather and

location reports as well as SOS messages

• Emergency Switch– Provides the stimulus for the SOS signal

• Red Light– Controls the activity of the emergency light

• Message Switch– Serves to generate and arbitrate various broadcast

messages

Page 45: Object-Oriented Development

Driver

Radio

Receiver

Wind Speed Sensor

Air Temp Sensor

Red

Light Emergency

Switch

Sensor Data Base

Water Temp Sensor

Radio Transmitter

Location Sensor

Message

Switch

Host at see buoy objects

Page 46: Object-Oriented Development

Operations Suffered by an Object

• Clock– None

• Wind Speed Sensors– Take Sample

• Air Temperature Sensors– Take Sample

• Water Temperature Sensors– Take Sample

• Location Sensor– Take Sample

Page 47: Object-Oriented Development

• Sensor Database– Put value– Get value

• Radio Receiver– None

• Radio Transmitter– Broadcast SOS

– Broadcast Weather/Location report

Page 48: Object-Oriented Development

• Emergency Switch– None

• Red Light– Set State

• Message Switch– Request History Report

– Request SOS

Page 49: Object-Oriented Development

Operations Required from an Object

• Clock– Force Sample– Force Periodic Report

• Wind Speed Sensors– Put Value

• Air Temperature Sensors– Put Value

• Water Temperature Sensors– Put Value

• Location Sensor– Put Value

Page 50: Object-Oriented Development

• Sensor Database– None

• Radio Receiver– Force History Report

– Set Light State

• Radio Transmitter– None

Page 51: Object-Oriented Development

• Emergency Switch– Force SOS

• Red Light– None

• Message Switch– Send Weather/Location Report

– Send SOS

NOTE: There is a balance between the operations suffered by and required of all objects. For each operation suffered by an object, we have other object or set of objects that require that action

Page 52: Object-Oriented Development

Ada Representationgeneric

type value is digits < >

with procedure Put_Value (The_Value: in Value);

package Air_Temperature_Sensors is

type Sensor is limited private;

procedure Take_Sample (The_Sensor: in out Sensor);

private

type Sensor is …

end Air_Temperature_Sensors;

Page 53: Object-Oriented Development

Clock

Message Switch

Sensor Data Base

Radio Transmitte

r

Location Sensor

Water Temp

Sensors

Wind peed

Sensors

Radio Receive

r

Reports

Red light

Air Temp

Sensors

Emergency Switch

Host at see buoy objects

Page 54: Object-Oriented Development

Conclusion

• The greatest strength of an object-oriented approach to development is that it offers a mechanism that captures a model of the real world.

• This leads to improved maintainability and understandability of systems whose complexity exceeds the intellectual capacity of a single developer or a team of developers