COP 4331 - PowerPoint PPT Presentation

About This Presentation
Title:

COP 4331

Description:

Design perspective is different from programming language perspective ... we sometimes introduce objects that are essentially only data holders. Example Object ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 14
Provided by: roybl
Learn more at: https://www.cse.fau.edu
Category:
Tags: cop | abstraction

less

Transcript and Presenter's Notes

Title: COP 4331


1
COP 4331 OODP
  • 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-OrientedSoftware 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
Write a Comment
User Comments (0)
About PowerShow.com