You are on page 1of 13

INTRODUCTION TO

OOP
Object Oriented Programming

Programming Paradigm
2

Procedural Programming

style of programming in which the


programming task is broken down into a
series of operations (called procedures)
applied to data (or data structures)
C and Pascal

Introduction to OOP

Programming Paradigm
3

Object Oriented Programming

extension of procedural programming


breaks down a programming task into a
series of interactions among different
entities or objects
Java, C++, and Smalltalk

Advanced Object-Oriented Concepts (Part 1)

Object Oriented
Programming

type of programming in which programmers define not


only the data structures, but also the types of
operations (methods) that can be applied to the data
structure
enables programmers to create modules that do not
need to be changed when a new type of object is added
most widely used paradigm
instead of focusing on what the system has to do, focus
on:
what objects the system contains
how they interact towards solving the
programming problem
Introduction to OOP

Object Oriented
Programming

Advantages of OOP over conventional


approaches:

It provides a clear modular structure for programs


which makes it good for defining abstract data
types where implementation details are hidden and
the unit has a clearly defined interface.
It makes it easy to maintain and modify existing
code as new objects can be created with small
differences from existing ones.
It provides a good framework for code libraries
where supplied software components can be easily
adapted and modified by the programmer.
Introduction to OOP

Object Oriented
Programming

Key OOP concepts:

Objects
Classes
Abstraction
Inheritance
Encapsulation
Polymorphism

Introduction to OOP

Objects and Classes


7

Objects

represent things from the real world


made up of

attributes characteristics that define an object

methods self-contained block of program code


similar to procedure

Introduction to OOP

Objects and Classes


8

Classes

term that describes a group or collection of


objects with common properties define a
type of object specifies methods and data
that type of object has

Introduction to OOP

Abstraction
9

allows a programmer to hide all but the


relevant information (to the problem at
hand) about an object in order to reduce
complexity and increase efficiency
closely related to encapsulation and
information hiding

Introduction to OOP

Encapsulation
10

refers to the hiding of data (attributes) and


methods within an object
protects an objects data from corruption
protects the objects data from arbitrary and
unintended use
hides the details of an objects internal
implementation from the users of an object
separates how an object behaves from how
it is implemented
Introduction to OOP

Inheritance
11

the process by which objects can acquire


(inherit) the properties of objects of other
class
provides reusability, like adding additional
features to an existing class without
modifying it
Use of extends keyword

Introduction to OOP

Polymorphism
12

refers to the ability to process objects


differently depending on their data type or
class
the ability to redefine methods for derived
classes

Introduction to OOP

Abstract Classes
13

class that is not used to create


(instantiate) objects
designed to act as a base class (to be
inherited
by other classes)

Introduction to OOP

You might also like