240 likes | 527 Vues
OBJECT ORIENTED TECHNOLOGY. Terminology and Basic Concepts. 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
E N D
OBJECT ORIENTED TECHNOLOGY Terminology and Basic Concepts
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
HISTORY OF OT • 1969 • Dr. Kristin Nygaard of Norway • Model fjord and movement of ships passing through it
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
Objects and Classes Operations Requests Attributes Inheritance Encapsulation Polymorphism OT BASIC CONCEPTS
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...
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 ...
HOW OBJECTS COMMUNICATE • An object is sent a message, which in turn causes an operation to be invoked • Sometimes the operation returns a response
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
INHERITING ATTRIBUTES • Objects can be decomposed into other objects • Generalization hierarchy • Supertype versus subtype • An object inherits the attributes in its parent class
OBJECT ORIENTED ANALYSIS & DESIGN (OAD) • The steps • Find Classes and Objects • Define Attributes • Define Services • Confused? Welcome to the OO Paradigm!
WHAT ARE CLASSES OF OBJECTS? • An object type or object class is a category of an object that has similar characteristics and behavior • Examples • employee or student • Aha! • An object type is found in the generalization hierarchy
OBJECT INSTANCES • An object instance is an 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!
OBJECT ORIENTED PROGRAMMING (OOP) • More synonyms: • operations are called methods • messages are called requests or events • An event contains the object name, the method, and maybe a group of parameters • Once an object receives an event, it runs a script (program) that may modify its state or send messages to other objects
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
POLY-WHAT? • Polymorphism • allows an instruction to be given to an object in the form of a generalized, rather than specific, detailed command • while specific actions would be different, results are the same
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
SUMMARY BY EXAMPLE • A 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