Presentation is loading. Please wait.

Presentation is loading. Please wait.

COP 4331 – OOD&P Lecture 7 Object Concepts. What is an Object Programming language definition: An instance of a class Design perspective is different.

Similar presentations


Presentation on theme: "COP 4331 – OOD&P Lecture 7 Object Concepts. What is an Object Programming language definition: An instance of a class Design perspective is different."— Presentation transcript:

1 COP 4331 – OOD&P Lecture 7 Object Concepts

2 What is an Object Programming language definition: An instance of a class Design perspective is different from programming language perspective Object: A thing you can interact with. Properties of Objects: –State –Behavior –Identity

3 Object & Their Properties Thing: a conceptual component of a system –May be physical or abstract State: the data that an object encapsulates determines its state –Data values are called attributes May be changeable (mutable) or immutable –Behavior may vary depending on state of an object

4 Object & Their Properties.2 Behavior: the way an object acts or reacts Messages sent to objects trigger behavior –Behavior often depends on state –Message may change state Identity –Each object can be distinguished from other objects in some way.

5 Object & Their Properties.2 Objects must be animate –They must have behavior Nouns in a problem statement are frequently associated with objects –But they also describe attributes Note: In object-oriented programming we sometimes introduce objects that are essentially only data holders

6 Example Object Object: myClock Attributes: Time Methods – resetTimeTo(theTime) – reportTime()

7 O-O Analysis Analysis: to understand a system as a collection of interacting objects –Identifying Objects –Identifying attributes –Identifying messages to which objects respond –Identifying relationships between objects

8 Object-Oriented Design Design a solution to a problem based on object-oriented analysis –Describe a particular solution –To a particular problem –Show how relationships are applied –Specify object interfaces Messages to which they respond Objects may have public and private interfaces

9 Classes Class describes a collection of objects that have the same –Role in the system –Set of attributes –Set of messages –Interface –Can be viewed as an object factory Does the work of creating objects An Object is an instance of a Class

10 Object-Oriented Software Engineering Capture requirements easily and accurately Provide more natural model of interacting systems Support modularity, encapsulation, and abstraction Makes implementation in O-O programming language relatively easy

11 Objects as Components Classes are, more or less, self-contained components Facilitates modification and reuse

12 Inheritance Supports additional abstraction through –Generalization from subclass to superclass –Specialization from superclass to subclass (Subclass is also called derived class)

13 Polymorphism Polymorphism allows the same name to be multiply defined The definition to use is determined from the context Most significant form in O-O design is when the meaning of a message is determined by what object receives it


Download ppt "COP 4331 – OOD&P Lecture 7 Object Concepts. What is an Object Programming language definition: An instance of a class Design perspective is different."

Similar presentations


Ads by Google