+ All Categories
Home > Documents > Introduction to Objects

Introduction to Objects

Date post: 13-Jan-2016
Category:
Upload: alvaro
View: 19 times
Download: 1 times
Share this document with a friend
Description:
Introduction to Objects. Adapted from “TEN STEPS TO OBJECT-SPEAK” a CPT Tech Talk by Joy Starks September 17, 1999. OBJECTIVES. Discuss the history of Object Oriented Technology (OT) Describe basic concepts of OT - PowerPoint PPT Presentation
25
Introduction to Objects Adapted from “TEN STEPS TO OBJECT- SPEAK” a CPT Tech Talk by Joy Starks September 17, 1999
Transcript
Page 1: Introduction to Objects

Introduction to Objects

Adapted from “TEN STEPS TO OBJECT-SPEAK”

a CPT Tech Talk by Joy Starks

September 17, 1999

Page 2: Introduction to Objects

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: Introduction to Objects

HISTORY OF OT

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

passing through it

Page 4: Introduction to Objects

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: Introduction to Objects

OT BASIC CONCEPTS

Objects and Classes

Operations Requests Attributes

Inheritance Encapsulation Polymorphism

Page 6: Introduction to Objects

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: Introduction to Objects

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: Introduction to Objects

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: Introduction to Objects

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: Introduction to Objects

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: Introduction to Objects

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: Introduction to Objects

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: Introduction to Objects

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: Introduction to Objects

ENCAPSULATION

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

Packaging data and operations together

Allows for information hiding The black box approach

Page 15: Introduction to Objects

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: Introduction to Objects

SOME BENEFITS OF OBJECTS

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 17: Introduction to Objects

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 18: Introduction to Objects

Your Turn

VCR A Sony VCR My VCR, Serial

#9234 Playback, record,

and audio dubbing the VCR contains

complex components that we assume work

Use the remote control

Match each VCR example on the left to the object-oriented term on the right.

object subtype messages object instance operations object encapsulation

Page 19: Introduction to Objects

Your Turn: Matching VCR IS an object A Sony VCR is an object subtype 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: Introduction to Objects

Objects are Models 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 21: Introduction to Objects

OBJECT STRUCTURE DIAGRAM

Large rectangle with two horizontal dividing lines

Top third object name

Middle third object attributes

Bottom thirdobject methods

Page 22: Introduction to Objects

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 23: Introduction to Objects

YOU TRY ONE ... Draw an object structure diagram

for the VCR object

VCRVCR

ButtonsButtonsOn-screen MessagesOn-screen Messages

PlayPlayRewindRewindFast ForwardFast ForwardStopStopRecordRecord

Page 24: Introduction to Objects

Summary of Terminology

Objects, Classes, Operations, Attributes

Inheritance, Encapsulation, Polymorphism

Generalization Hierarchies Object Structure Diagrams Event Diagrams

Page 25: Introduction to Objects

The End


Recommended