Introduction to Object Oriented Programming OOP - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Introduction to Object Oriented Programming OOP

Description:

mango, apple and orange are objects of the class Fruit. ... Fruit mango; Data Abstraction and Encapsulation. Basic Concepts of OOP (Cont. ... – PowerPoint PPT presentation

Number of Views:182
Avg rating:3.0/5.0
Slides: 18
Provided by: amandaso
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Object Oriented Programming OOP


1
IntroductiontoObject OrientedProgramming (OOP)
2
Introduction
  • Many programming approaches have been tried to
    handle complex problems
  • modular programming
  • top-down programming
  • bottom-up programming
  • structured programming
  • Object Oriented Programming (OOP)
  • latest programming approach to handles
    problems
  • Eliminate some of the pitfalls of conventional
    programming
  • Model real-world problems well

3
Procedure-Oriented Programming
  • Use high level languages such as Pascal, C.
  • Problem is viewed as a sequence of things to
    be done
  • reading
  • calculating
  • printing, etc.
  • Functions are written to accomplish this task.
  • Primary focus on functions.
  • Very little attention to data that are being
    used by various functions

4
Structure of procedure-oriented programs
5
Procedure-Oriented (Cont.)
  • Drawbacks
  • Global data more prone to unintentional change
  • In large programs, difficult to identify what
    data is used by which functions.
  • In case of revising an external data
    structure, need to revise all functions that
    access the data

6
Procedure-Oriented (Cont.)
  • Some characteristics
  • Emphasis is on doing things (algorithms).
  • Large programs are divided into smaller
    programs known as functions.
  • Most of the functions share global data.
  • Data move openly around the system from
    function to function.
  • Functions transform data from one form to
    another.
  • Employs top-down approach in program design.

7
OOP Paradigm
  • OOP
  • treats data as critical factor in the program
    development
  • does not allow data to flow freely around the
    system
  • ties data to functions that operate on it
  • protect data from accidental changes from
    outside functions
  • Decompose a problem into a number of entities
    called objects (datafunctions).
  • Data of an object can be accessed only
    functions that bind to the object
  • However, functions of one object can access
    the functions of other object.

8
Organization of data and functions in OOP
9
Object-Oriented (Cont.)
  • Some of the important features
  • Emphasis is on data rather than procedure.
  • Programs are divided into what are known as
    objects.
  • Data structures are designed such that they
    characterize the objects.
  • Functions that operate on the data of an
    object are tied together in the data structure.
  • Data is hidden and cannot be accessed by
    external functions.
  • Objects may communicate with each other
    through functions.
  • New data and functions can be easily added
    whenever necessary.

10
Basic Concepts of OOP
  • Objects
  • Basic run-time entities
  • May be a person, a place, or any item
  • Problem analyzed in terms of objects and nature
    of communication between them
  • Objects should be chosen s.t. they match
    closely with real-world object.
  • Objects interact by sending messages to one
    another.
  • Customer object sends a message to Account
    Object requesting current balance.
  • They can interact without knowing each others
    data and codes.

11
Representation of an object
12
Basic Concepts of OOP (Cont.)
  • Classes
  • Collection of similar objects
  • Once a class has been defined, we can create
    any number of objects belonging to that class.
  • mango, apple and orange are objects of the
    class Fruit.
  • Classes are user-defined data types and behave
    like built-in data types.
  • Fruit mango

13
Basic Concepts of OOP (Cont.)
  • Data Abstraction and Encapsulation
  • Encapsulation - combing of the data and
    functions into a single unit (called class)
  • Data hiding data is not accessible to the
    outside world (other classes)
  • Data abstraction includes only features
    relevant to the problem neglecting other
    unnecessary details

14
Basic Concepts of OOP (Cont.)
  • Inheritance
  • Process by which objects of one class acquire
    the properties of objects of another class.
  • Reusability that we can add additional
    features to an existing class without modifying
    it

15
Basic Concepts of OOP (Cont.)
  • Polymorphism
  • Ability to take more than one form.
  • The behavior depends on the types of data used
    in operation.

16
Benefits of OOP
  • Through inheritance, we can eliminate
    redundant code and extend the use of existing
    classes.
  • We can build programs from standard working
    modules rather than having to start from the
    scratch. This leads to saving of development
    time higher productivity.
  • Data hiding helps the programmer to secure
    programs that cannot be invaded by code in
    other parts of the program.
  • It is possible to map objects in the problem
    domain to those objects in the program.

17
Benefits of OOP (Cont.)
  • It is easy to partition the work in a project
    based on objects.
  • The data-centered design approach enables us
    to capture more details of a model in
    implementable form.
  • Object-oriented systems can be easily upgraded
    from small to large systems.
  • Software complexity can be easily managed.
Write a Comment
User Comments (0)
About PowerShow.com