0% found this document useful (0 votes)
5 views31 pages

Object Oriented Programming Concepts

Uploaded by

bhobgeneralesura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views31 pages

Object Oriented Programming Concepts

Uploaded by

bhobgeneralesura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Republic of the Philippines

CEBU TECHNOLOGICAL UNIVERSITY


BARILI CAMPUS
Barili, Cebu, Philippines
1st Semester, AY 2024 – 2025
Department of Industrial and Communications Technology

Object-Oriented Programming (OOP)


Concepts

Prepared by:
JUNE CLIFFORD L. CUBAR
PART TIME INSTRUCTOR
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
AGENDA 1
 Introduction : History, OOP,
Objects, Classes
 OOP Basic concepts:
Encapsulation, Inheritance,
Abstraction and Polymorphism

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


Why do we need OOP? 2
 OOP was developed because
limitations were discovered in
earlier approaches to
programming.

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


Computer Programming 3
 An Algorithm is a step-by-step
process.
 A Computer Program is a step-
by-step set of instructions for
a computer.
 Every computer program is an
algorithm.
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
Programming Languages 4
• Programming languages allows
programmers to develop software.
• The three major families of
languages are:
1. Machine language
2. Assembly language
3. High-level language
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
Machine language 4.1
• Comprised of 1s and 0s.
• The “native language” of a
computer.

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


Assembly language 4.2
• Are comprised of a set o
elemental commands which are
tied to specific processor.
• It needs to be translated to
machine language before the
computer processes it. Assembler
will translate to machine
language.
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
High-level language (HL) 4.3
• High-level languages represents a
giant leap towards easier
programming.
• Some syntax of high-level
language is similar to English.
• HL divided into 2 groups:
1. Procedure-Oriented Programming
(POP)
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
Procedure-Oriented 4.3.1
Programming
• Are characterized by sequential
sets of linear commands. The
focus of such language is on
structure.
• Example include: C, COBOL,
Fortran, Perl and Pascal.

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


Procedure-Oriented 4.3.1
Programming
• Each statement in the language
tells the computer to d
something:
- get some input
- add these numbers
-display that output.
• A program in a procedural
language is a list of instructions.
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
Procedure-Oriented 4.3.1
Programming
 Division into functions:
 Procedural program is divided
into functions.
 Each functions has clearly
defined purpose.

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


Procedure-Oriented 4.3.1
Programming

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


Procedure-Oriented 4.3.1
Programming
 In Multi-function program
important data items are place as
global so that they may be
accessed by all functions.

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


Procedure-Oriented 4.3.1
Programming
 Drawbacks:
 We can access the data of one
function from other since there
is no protection.
 If new data is to be added, all
the function needed to be
modified to access the data.
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
Procedure-Oriented 4.3.1
Programming
 Drawbacks:
 In large program it is very
difficult to identify what data is
used by which function.
 Does not model real world
problem very well.

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


Procedure-Oriented 4.3.1
Programming
 Characteristics:
 Large program are divided into
smaller programs known as
function.
 Most of the function share
global data.
 Data openly around the system
from function to function.
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
Object-Oriented 4.3.2
Programming
 OOP introduced to overcome flaws
in the procedural approach to
programming.
 OOP focus on modeling data not
on structure.
 Programmers code using
“blueprints” of data models
called classes.
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
OBJECT-ORIENTED
PROGRAMMING

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


OOP Characteristics 5
 OOP programmer define not
only the data type of a data
structure, but also the types of
operations/methods that can
be applied to the data
structure.

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


OOP Basic Terminology 6
 OBJECT – usually a person,
place or thing (a noun).
 METHOD – an action performed
by an object (a verb).
 PROPERTY or ATTRIBUTE –
Characteristics of certain
object.
 CLASS – a category of similar
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
BASIC CONCEPTS OF
OOP 6
 Objects
 Classes
 Data Abstraction
 Data Encapsulation
 Inheritance
 Polymorphism
 Dynamic binding
 Message Passing.
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
CLASSES & OBJECT

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


What are Objects? 7
 Objects are the basic run time
entities in an object oriented
system.
 They may represent a person,
a place, a bank account, a
table of data or any item that
the program has to handle.
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
What are Objects? 7.1
 Software object model real-
world objects or abstract
concepts.
 Example: Dog, Bicycle,
Keyboard, Person.

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


What are Objects? 7.2
 Object is any entity that has
state and behavior.
Example: Object is Dog.
 Dogs’ states: name, age,
color, breed
 Dogs’ behaviors: Sleep, Eat,
bark.
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
What are Objects? 7.3
 How do software object
implement real world object:
 Use variables/data to
implement states
 Use methods/functions to
implement behavior.
 An object is a software bundle
of variables and related
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
Classes 8
 A class is a prototype, idea,
and blueprint for creating
objects.
 Class is composed of three
things: its name ,
attributes/properties, and
methods/operations.
 A class defines the methods
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
Classes 8.1

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


Classes 8.2
 Objects are variables of class.
 Once a class has been defined
we can create any number of
objects or that class.
 A class is collections of objects
of similar type.
 Before we can create an
object, we need to define the
PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)
Classes and Object
Examples 9

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)


Classes and Object
Examples
9.1

PELEC 1 – PROFESSIONAL ELECTIVE 1 (OBJECT ORIENTED PRGRAMMING)

You might also like