CHAPTER 1 INTRODUCTION TO OBJECTORIENTED PROGRAMMING - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

CHAPTER 1 INTRODUCTION TO OBJECTORIENTED PROGRAMMING

Description:

Object Oriented Programming (OOP) was first proposed in the late 1960s. In 1990, object oriented software engineering became the paradigm of choice for ... – PowerPoint PPT presentation

Number of Views:83
Avg rating:3.0/5.0
Slides: 19
Provided by: tmskUi
Category:

less

Transcript and Presenter's Notes

Title: CHAPTER 1 INTRODUCTION TO OBJECTORIENTED PROGRAMMING


1
CHAPTER 1 INTRODUCTION TO OBJECT-ORIENTED
PROGRAMMING
  • ITS131
  • Object-Oriented Technology

2
Objectives
  • Name the basic components of object-oriented
    programming.
  • Differentiate classes and objects.
  • Describe the significance of inheritance in
    object-oriented programs.

3
Introduction
  • A new programming paradigm
  • Imperative programming (Pascal, C)
  • Logic programming (Prolog)
  • Functional programming (FP, Haskell)
  • Object Oriented Programming (OOP) was first
    proposed in the late 1960s
  • In 1990, object oriented software engineering
    became the paradigm of choice for many software
    product builder.
  • Message passing is heart of OO.

4
Introduction
  • Object-Oriented Language
  • Java
  • C
  • VB
  • SmallTalk
  • Ada95

5
(1) OBJECT
  • Object-oriented programs use objects.
  • An object is a thing, both tangible (physical)
    and
  • intangible (conceptual). Account, Vehicle,
  • Employee, Building, etc. are examples of
    possible
  • objects.
  • Example 1
  • For purposes of modeling a company, a CEO
  • could view employees, buildings, divisions,
  • documents, and benefits packages as objects.



6
(1) OBJECT
  • Example 2
  • An automotive engineer would see tires, doors,
  • engines, top speed, and the current fuel level
    as
  • objects.
  • An object is comprised of data and operations
    that
  • manipulate those data.



7
(2) ATTRIBUTES/ABSTRACTION
  • The attributes of an object is the value of the
  • object, or a set of circumstances describing
    the
  • object.
  • Example 1
  • The attributes of an electric light bulb would
    be
  • "on" or "off" .
  • Example 2
  • The attributes of a clock object would be the
    time .



8
(3) OPERATIONS
  • An object encapsulates data ( represented as a
  • collection of attributes).
  • Operations is the algorithm that process the
    data.
  • Each of the operation of the object represent
    the
  • behavior of the object.



9
(4) CLASS
  • Inside a program we write instructions to create
  • objects. For the computers to be able to create
    an
  • object, we must provide a definition called a
    class.
  • A class is a kind of template that the computer
  • uses to create objects, so a class must be
    defined
  • before you can create an object of the class.
  • In other way, a class is a generalized
    description
  • that describes a collection of similar
    objects.



10
(4) CLASS
  • An object is called an instance of a class.
  • An object is an instance of exactly one class.
  • An instance of a class belongs to the class.
  • Example
  • Class Customer
  • Objects Jack and Jill
  • Jack and Jill are the instances of Customer
  • Two Customer objects with the names of Jack and
  • Jill.



11
(4) CLASS
  • Representation of Object Oriented Class


ATTRIBUTES
CLASS NAME
CLASS NAME Furniture

ATTRIBUTES -color -price -weight -dimension
OPERATIONS
OPERATIONS -buy -sell
12
(5) MESSAGES
  • To instruct a class or an object to perform a
    task,
  • we send a message to it.
  • You can send a message only to the classes and
  • objects that understand the message you sent
    to
  • them.



13
(5) Messages
Class name FEES PAYMENT
Class name STUDENT
Attributes -name -subjects taken -payment
Attributes -name -IC -course -subjects
Operations -Total payment
Operations Register subject
MESSAGE
Message passing between two objects
14
(6) METHODS
  • A class or an object must possess a matching
  • method to be able to handle the received
    message.
  • A method defined for a class is called a class
  • method, and a method defined for an object is
  • called an instance method.



15
(7) INHERITANCE
  • In object-oriented programming, we use a
  • mechanism called inheritance to design two or
  • more entities that are different but share
    many
  • common features.


16
(7) INHERITANCE
  • First, we define a class that contains the
  • common features of the entities.
  • Then we define classes as an extension of the
  • common class inheriting everything from the
  • common class.


17
(4) INHERITANCE
  • We call the common class the superclass and all
  • classes that inherit from it subclasses.
  • We also call the superclass an ancestor and the
  • subclass a descendant.


18
(4) INHERITANCE

Class name FURNITURE Attributes
SUPERCLASS
OPERATIONS

SUBCLASS
Class name TABLE
Class name CHAIR
Class name DESK
Attributes
Attributes
Attributes
OPERATIONS
OPERATIONS
OPERATIONS
Write a Comment
User Comments (0)
About PowerShow.com