Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Objects Adapted from “TEN STEPS TO OBJECT-SPEAK” a CPT Tech Talk by Joy Starks September 17, 1999.

Similar presentations


Presentation on theme: "Introduction to Objects Adapted from “TEN STEPS TO OBJECT-SPEAK” a CPT Tech Talk by Joy Starks September 17, 1999."— Presentation transcript:

1

2 Introduction to Objects Adapted from “TEN STEPS TO OBJECT-SPEAK” a CPT Tech Talk by Joy Starks September 17, 1999

3 OBJECTIVES n Discuss the history of Object Oriented Technology (OT) n Describe basic concepts of OT n Define terms in Object Oriented Analysis & Design (OAD) and Programming (OOP) n Relate definitions to real-world examples n Mention some benefits of OT n Practice by Example

4 HISTORY OF OT n 1969 n Dr. Kristin Nygaard of Norway n Model fjord and movement of ships passing through it

5 HISTORY OF OT n The Problem ä structured programming separates data from procedures n The Solution ä Object Oriented Programming ä model each component (data and procedure) as a single unit ä model relationships between components

6 OT BASIC CONCEPTS n Objects and Classes n Operations n Requests n Attributes n Inheritance n Encapsulation n Polymorphism

7 WHAT’S AN OBJECT? n Anything, real or abstract, about which we store data n Dr. Nygaard’s objects ä mathematical models of boats ä physical aspects of the fjord being analyzed n Other Examples ä an invoice, an organization, a screen with which a user interacts, a drawing, an airplane, an order-filling process...

8 WHAT’S AN OPERATION? n An activity that reads or manipulates data of an object n Dr. Nygaard’s operations ä boats float, sink, move etc. n Other Examples ä calculating a total, checking a balance, adding a new employee, changing an address, deleting a customer...

9 HOW OBJECTS COMMUNICATE n An object is sent a message, which in turn causes an operation to be invoked n Sometimes the operation returns a response

10 WHAT’S AN ATTRIBUTE? n Characteristics that add detail to an object n Dr. Nygaard’s attributes ä color, weight, size, etc. n Other Examples ä someone’s name or address, an employee’s title, a book’s author, a part number, a room’s dimensions

11 INHERITING ATTRIBUTES n Objects can be decomposed into other objects n Generalization hierarchy n Supertype versus subtype n An object inherits the attributes in its parent class

12 SAMPLE GENERALIZATION HIERARCHY

13 WHAT ARE CLASSES? n An object type or object class is a category of an object that has similar characteristics and behavior n Example: employee or student n A class acts as a template or blueprint for object instances

14 OBJECT INSTANCES n An object instance is a specific example of an object type n Examples ä John P. Smith, Invoice #12356 n And just to make it all really confusing, object instances are sometimes called objects!

15 ENCAPSULATION n The process of making implementation details of an object transparent to a user n Packaging data and operations together n Allows for information hiding n The black box approach

16 POLY-WHAT? n 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 n Example ä Animal: Speak ä Dogs bark; cats meow

17 SOME BENEFITS OF OBJECTS n Reusability ä classes can be reused or inherited n Stability ä over time, classes become more stable n Easier Design ä black box concept n Faster Design ä create applications from existing components

18 Practicing n A mammal is an object n Bear, buffalo, whale, and dolphin are subtypes n Yogi, Wilbur, and Smokey are instances of the Bear subtype n Eye color, ear size, and weight are attributes

19 Your Turn n VCR n A Sony VCR n My VCR, Serial #9234 n Playback, record, and audio dubbing n the VCR contains complex components that we assume work n Use the remote control Match each VCR example on the left to the object-oriented term on the right. n object subtype n messages n object instance n operations n object n encapsulation

20 Your Turn: Matching n VCR IS an object n A Sony VCR is an object subtype n Serial #9234 of Sony VCR is an object instance n Playback, record, and audio dubbing are examples of VCR operations n The concept that the VCR contains complex components you assume work is encapsulation n When you use a remote control, you are sending requests to the VCR

21 Objects are Models n 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 than a real car

22 OBJECT STRUCTURE DIAGRAM n Large rectangle with two horizontal dividing lines n Top third  object name n Middle third  object attributes n Bottom third  object methods

23 SAMPLE OBJECT STRUCTURE DIAGRAM TRAFFIC LIGHT Color Turn Red Turn Yellow Turn Green The operations are described in terms of what they do -- not how they do it.

24 YOU TRY ONE... n Draw an object structure diagram for the VCR objectVCRButtons On-screen Messages PlayRewind Fast Forward StopRecord

25 Summary of Terminology n Objects, Classes, Operations, Attributes n Inheritance, Encapsulation, Polymorphism n Generalization Hierarchies n Object Structure Diagrams n Event Diagrams

26 The End


Download ppt "Introduction to Objects Adapted from “TEN STEPS TO OBJECT-SPEAK” a CPT Tech Talk by Joy Starks September 17, 1999."

Similar presentations


Ads by Google