0% found this document useful (0 votes)
11 views16 pages

Introduction to Object-Oriented Programming

The document introduces Object-Oriented Programming (OOP) and contrasts it with Procedural Programming. It outlines the evolution of programming paradigms, emphasizing the advantages of OOP such as data encapsulation, inheritance, and polymorphism. Additionally, it provides an overview of C and C++ languages, highlighting their characteristics and differences in programming approaches.

Uploaded by

bhavani.kanwar
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)
11 views16 pages

Introduction to Object-Oriented Programming

The document introduces Object-Oriented Programming (OOP) and contrasts it with Procedural Programming. It outlines the evolution of programming paradigms, emphasizing the advantages of OOP such as data encapsulation, inheritance, and polymorphism. Additionally, it provides an overview of C and C++ languages, highlighting their characteristics and differences in programming approaches.

Uploaded by

bhavani.kanwar
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

OBJECT ORIENTED PROGRAMMING (3CS4-06)

Lecture-1 INTRODUCTION
Focus
• Focus on
• Programming Concepts
• Programming Design Techniques
• Don’t get lost in
• Language Technical Details

2
What is programming?
Programming is taking
A problem
Find the area of a rectangle
A set of data
length
width
A set of functions
area = length * width
Then,
Applying functions to data to solve the problem

3
Programming Concept Evolution
• Unstructured
• Procedural
• Object-Oriented

4
Programming Paradigm
• Paradigm means approach i.e. the way of solving problem
• Every programming language have some paradigm.
• There are mainly two programming paradigm used by most of the
programming languages i.e. Procedural and Object Oriented
Paradigm.
Procedural Paradigm
• The problem is viewed as sequence of things to be done such as reading , calculation and printing.

• Basically consist of writing a list of instruction or actions for the computer to follow and organizing
these instruction into groups known as functions.
Procedural Paradigm
(Disadvantages)
• Global data access
• It does not model real word problem very well
• No data hiding
Characteristics of Procedural
Paradigm
• Emphasis is on doing things(algorithm).
• 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.
• Function transforms data from one form to another.
• Employs top-down approach in program design.
Object Oriented Paradigm
• An approach that provides a way of
modularizing programs by creating
partitioned memory area for both data
and functions that can be used as
template for creating copies of such
modules on demand.
• Based on modular approach.
Object Oriented Paradigm
(Advantages)
• Easy to develop large and complex applications.
• Highly extensible and secure.
• Faster to design and develop applications.
• Real world problems can be better modeled.
• Includes advanced features like data hiding, polymorphism,
inheritance, templates, exception handling, etc.
Characteristics of Object Oriented
Paradigm
• Emphasis is on doing 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 can’t be accessed by external functions.
• Objects may communicate with each other through functions.
• New data and functions can be easily added.
• Follows bottom-up approach in program design.
Difference between Procedural and Object Oriented approach
Procedural Paradigm Object Oriented Paradigm
Program is divided into small parts called functions Program is divided into parts called objects.
Importance is not given to data but to functions as Importance is given to the data rather than
well as sequence of actions to be done. procedures or functions because it works as a real
world.
Follows Top Down approach. OOP follows Bottom Up approach.
It does not have any access specifier. OOP has access specifiers named Public, Private,
Protected, etc.
Data can move freely from function to function in the Objects can move and communicate with each other
system. through member functions.
To add new data and function in POP is not so easy. OOP provides an easy way to add new data and
function.
Most function uses Global data for sharing that can be In OOP, data can not move easily from function to
accessed freely from function to function in the function, it can be kept public or private so we can
system. control the access of data.
Difference between Procedural and Object Oriented approach
(cont…)

Procedural Paradigm Object Oriented Paradigm


It does not have any proper way for hiding data so it is OOP provides Data Hiding so provides more security.
less secure.
Overloading is not possible. In OOP, overloading is possible in the form of Function
Overloading and Operator Overloading.
Example of Procedure Oriented Programming are : C, Example of Object Oriented Programming are : C++,
VB, FORTRAN, Pascal. JAVA, [Link], C#.NET.
Overview of C Language
• C language is known as structure oriented language or procedure oriented language.
• Employs top-down programming approach where a problem is viewed as a sequence of
tasks to be performed.
• All program code of c can be executed in C++ but converse many not be possible.
• Function overloading and operator overloading are not possible.
• Local variables can be declared only at the beginning of the block.
• Program controls are through jumps and calls to subroutines.
• Polymorphism, encapsulation and inheritance are not possible.
• For solving the problems, the problem is divided into a number of modules. Each module is
a subprogram.
• Data abstraction property is not supported by procedure oriented language.
• Data in procedure oriented language is open and can be accessed by any function.
Overview of C++ Language
• C++ can be considered as an incremental version of c language which consists all programming
language constructs with newly added features of object oriented programming.
• C++ is both structure(procedure) oriented and object oriented programming language.
• The file extension of C++ program is “.CPP”.
• Function overloading and operator overloading are possible.
• Variables can be declared in inline i.e. when required.
• In C++ more emphasis is give on data rather than procedures.
• Polymorphism, encapsulation and inheritance are possible.
• Data abstraction property is supported by C++.
• Data access is limited. It can be accessed by providing various visibility modes both for data and
member functions. there by providing data security by data hiding
• Dynamic binding is supported by C++.
• It supports all features of C language.
• It can be called as an incremental version of C language
Todays Lecture Summary
• There are many different kinds of programming paradigms, OOP is
one among them.
• In OOP, programmers see the execution of the program as a collection
of dialoging objects.
• The main characteristics of OOPL include encapsulation, inheritance,
and polymorphism.

16

You might also like