ten steps to object-speak

32
TEN STEPS TO OBJECT-SPEAK Terminology & Basic Concepts Joy Starks September 17, 1999

Upload: afra

Post on 13-Jan-2016

26 views

Category:

Documents


0 download

DESCRIPTION

TEN STEPS TO OBJECT-SPEAK. Terminology & Basic Concepts Joy Starks September 17, 1999. OBJECTIVES. Discuss the history of Object Oriented Technology (OT) Describe basic concepts of OT Define terms in Object Oriented Analysis & Design (OAD) and Programming (OOP) - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: TEN STEPS TO  OBJECT-SPEAK

TEN STEPS TO OBJECT-SPEAK

Terminology & Basic ConceptsJoy Starks

September 17, 1999

Page 2: TEN STEPS TO  OBJECT-SPEAK

OBJECTIVES

Discuss the history of Object Oriented Technology (OT)

Describe basic concepts of OT Define terms in Object Oriented Analysis

& Design (OAD) and Programming (OOP) Relate definitions to real-world examples Mention some benefits of OT Practice by Example

Page 3: TEN STEPS TO  OBJECT-SPEAK

HISTORY OF OT

1969 Dr. Kristin Nygaard of Norway Model fjord and movement of ships

passing through it

Page 4: TEN STEPS TO  OBJECT-SPEAK

HISTORY OF OT

The Problem structured programming separates data

from procedures The Solution

Object Oriented Programming model each component (data and

procedure) as a single unit model relationships between

components

Page 5: TEN STEPS TO  OBJECT-SPEAK

OT BASIC CONCEPTS

Objects and Classes

Operations Requests Attributes

Inheritance Encapsulation Polymorphism

Page 6: TEN STEPS TO  OBJECT-SPEAK

WHAT’S AN OBJECT?

Anything, real or abstract, about which we store data

Dr. Nygaard’s objects mathematical models of boats physical aspects of the fjord being analyzed

Other Examples an invoice, an organization, a screen with

which a user interacts, a drawing, an airplane, an order-filling process...

Page 7: TEN STEPS TO  OBJECT-SPEAK

WHAT’S AN OPERATION?

An activity that reads or manipulates data of an object

Dr. Nygaard’s operations boats float, sink, move etc.

Other Examples calculating a total, checking a balance,

adding a new employee, changing an address, deleting a customer ...

Page 8: TEN STEPS TO  OBJECT-SPEAK

HOW OBJECTS COMMUNICATE

An object is sent a message, which in turn causes an operation to be invoked

Sometimes the operation returns a response

Page 9: TEN STEPS TO  OBJECT-SPEAK

WHAT’S AN ATTRIBUTE?

Characteristics that add detail to an object

Dr. Nygaard’s attributes color, weight, size, etc.

Other Examples someone’s name or address, an

employee’s title, a book’s author , a part number, a room’s dimensions

Page 10: TEN STEPS TO  OBJECT-SPEAK

INHERITING ATTRIBUTES

Objects can be decomposed into other objects

Generalization hierarchy Supertype versus subtype An object inherits the attributes in

its parent class

Page 11: TEN STEPS TO  OBJECT-SPEAK

SAMPLE GENERALIZATION HIERARCHY

SAM PLE PER SO N O BJEC T

1st Sem ester 2nd Semester

Freshm an Sophom ore

Student Em ployee

Person

Page 12: TEN STEPS TO  OBJECT-SPEAK

WHAT ARE CLASSES?

An object type or object class is a category of an object that has similar characteristics and behavior

Example: employee or student A class acts as a template or

blueprint for object instances

Page 13: TEN STEPS TO  OBJECT-SPEAK

OBJECT INSTANCES

An object instance is a specific example of an object type

Examples John P. Smith, Invoice #12356

And just to make it all really confusing, object instances are sometimes called objects!

Page 14: TEN STEPS TO  OBJECT-SPEAK

ENCAPSULATION

The process of making implementation details of an object transparent to a user

Packaging data and operations together

Also called information hiding The black box

Page 15: TEN STEPS TO  OBJECT-SPEAK

POLY-WHAT? Polymorphism

the ability of two or objects to respond to the same message, each in its own way

an instruction is given using a generalized, rather than specific, detailed command

while specific actions would be different, results are the same

Example Animal: Speak Dogs bark; cats meow

Page 16: TEN STEPS TO  OBJECT-SPEAK

COMPARING SYNONYMSOT OAD OOP

Object Object TypeObject Class

ClassPackageModule

Operation Service Method

Message RequestEvent

Attribute Variable

Page 17: TEN STEPS TO  OBJECT-SPEAK

SOME BENEFITS OF OT

Reusability classes can be reused or inherited

Stability over time, classes become more stable

Easier Design black box concept

Faster Design create applications from existing components

Page 18: TEN STEPS TO  OBJECT-SPEAK

Practicing A mammal is an object Bear, buffalo, whale, and dolphin

are subtypes Yogi, Wilbur, and Smokey are

instances of the Bear subtype Eye color, ear size, and weight are

attributes

Page 19: TEN STEPS TO  OBJECT-SPEAK

Your Turn: Matching VCR IS an object A Sony VCR is an object type Serial #9234 of Sony VCR is an object instance Playback, record, and audio dubbing are

examples of VCR operations The concept that the VCR contains complex

components you assume work is encapsulation When you use a remote control, you are

sending requests to the VCR

Page 20: TEN STEPS TO  OBJECT-SPEAK

One More Example

If “brunch items” is a supertype, list a subtype.

If muffin is a subtype, list an attribute.

If muffin is a subtype, list an operation.

If muffin is a subtype, list an instance.

Page 21: TEN STEPS TO  OBJECT-SPEAK

A MODEL . . .

represents an aspect of reality helps us to understand reality assists us in inventing systems or

redesigning business areas should be simpler than reality

for example, model cars are simpler thana real car

Page 22: TEN STEPS TO  OBJECT-SPEAK

OBJECT STRUCTURE DIAGRAM

Large rectangle with two horizontal dividing lines

Top third object name

Middle third object attributes

Bottom thirdobject methods

Page 23: TEN STEPS TO  OBJECT-SPEAK

SAMPLE OBJECT STRUCTURE DIAGRAM

TRAFFIC LIGHTTRAFFIC LIGHT

ColorColor

Turn RedTurn RedTurn YellowTurn YellowTurn GreenTurn Green

The operations are described in terms of whatthey do -- not how they do it.

Page 24: TEN STEPS TO  OBJECT-SPEAK

YOU TRY ONE ... Draw an object structure diagram

for the VCR object

VCRVCR

ButtonsButtonsOn-screen MessagesOn-screen Messages

PlayPlayRewindRewindFast ForwardFast ForwardStopStopRecordRecord

Page 25: TEN STEPS TO  OBJECT-SPEAK

EVENT DIAGRAMS

Show events and the operations triggered by the events

Operations in rounded rectangles Events on lines with arrows

Page 26: TEN STEPS TO  OBJECT-SPEAK

TRIGGERS

A trigger is an action that causes an event

An operation has no knowledge of what triggered it or why

An operation does not know what events are triggered by its result

External triggers in shadowed rounded rectangles

TRIGGER

Page 27: TEN STEPS TO  OBJECT-SPEAK

SAMPLE EVENT DIAGRAM FOR REWIND OPERATION

VCR User PressesVCR User PressesRewind ButtonRewind Button

RewindRewindCompleteCompleteVCR VCR

RewindsRewindsVCRVCRDisplaysDisplays““Ready”Ready”

RewindRewindRequestedRequested

VCR VCR StartsStartsRewindRewind

RewindRewindStartedStarted VCRVCR

DisplaysDisplays““Rewinding”Rewinding”

Page 28: TEN STEPS TO  OBJECT-SPEAK

YOU TRY ONE ...

You press START on the coffee maker The coffee maker begins heating up

the water The “brewing” light is on When the water is hot, coffee drips

into the pot When the pot is full, the “brewing”

light shuts off

Page 29: TEN STEPS TO  OBJECT-SPEAK

SAMPLE ANSWERPush Coffee MakerPush Coffee MakerSTART ButtonSTART Button

CoffeeCoffeeRequestedRequested

WaterWaterbeginsbeginsheatingheating

““Brewing”Brewing”light displayslight displays

Water isWater isgetting getting hothot

WaterWaterfinishesfinishesheatingheating

WaterWateris hotis hot

WaterWaterdripsdripsinto potinto pot

Pot isPot isfilling upfilling up

Coffee Coffee reaches reaches top of pottop of pot

CoffeeCoffeeis doneis done

““Brewing”Brewing”light turnslight turnsoffoff

Page 30: TEN STEPS TO  OBJECT-SPEAK

Summary of Terminology

Objects, Classes, Operations, Attributes

Inheritance, Encapsulation, Polymorphism

Generalization Hierarchies Object Structure Diagrams Event Diagrams

Page 31: TEN STEPS TO  OBJECT-SPEAK

SUMMARY OF MODELS

OAD consists of object structure analysis & design object behavior analysis & design

Object-structure diagrams show the object name, attributes, and methods

Event diagrams show the events and the methods (operation) triggered by the events

Page 32: TEN STEPS TO  OBJECT-SPEAK