POP & OOP Short Note
ØWhat is
POP?
POP
full form is Procedure Oriented Programming. Procedural programming is a programming paradigm, derived from structured
programming, based upon the concept of the procedure call.
When
program become larger, it is divided into function & each function has
clearly defined purpose. Dividing the program into functions & module is
one of the cornerstones of structured programming. E.g.:- c, basic,
FORTRAN.
Ø
Characteristics of Procedural Oriented Programming:-
§ It focuses on
process rather than data.
§ It takes a
problem as a sequence of things to be done such as reading, calculating and
printing. Hence, a number of functions are written to solve a problem.
§ A program is
divided into a number of functions and each function has clearly defined
purpose.
§ Most of the
functions share global data.
§ Data moves
openly around the system from function to function.
Ø
Drawback of POP (structured programming):-
§ It emphasis on
doing things. Data is given a second class status even through data is the
reason for the existence of the program.
§ Since every
function has complete access to the global variables, the new programmer can
corrupt the data accidentally by creating function. Similarly, if new data is
to be added, all the function needed to be modified to access the data.
§ It is often
difficult to design because the components function and data structure do not
model the real world.
§ Modularity is generally desirable, especially
in large, complicated programs.
Ø What Is OOP?
It means Object Oriented
Programming. To overcome
the drawbacks of POP this
Programming language was introduced. It’s organized
around objects rather than actions and data rather than
logic.
OOP is a programming paradigm based on the
concept of objects, which may contain data, in
the form of fields, often known as attributes; and code, in the form of procedures, often known as methods. The most popular
ones are class-based, meaning that objects are instances of classes,
which typically also determine their type.
Many of the most widely used programming languages
such as C++, Object Pascal, Java, Python etc. are multi-paradigm
programming languages that support object-oriented programming.
The
core of the pure object-oriented programming is to create an object, in code,
that has certain properties and methods. While designing C++ modules, we try to
see whole world in the form of objects.
For
example a car is an object which has certain properties such as color, number
of doors, and the like. It also has certain methods such as accelerate, brake,
and so on.
Ø Concepts Of OOP:-
·
Object-
This is the
basic unit of object oriented programming. That is both data and function that
operate on data are bundled as a unit called as object.
·
Class-
When you define a class, you define a blueprint for an
object. This doesn't actually define any data, but it does define what the
class name means, that is, what an object of the class will consist of and what
operations can be performed on such an object.
·
Abstraction-
Data abstraction refers to, providing only essential
information to the outside world and hiding their background details, i.e., to
represent the needed information in program without presenting the details.
For example, a
database system hides certain details of how data is stored and created and
maintained. Similar way, C++ classes provides different methods to the outside
world without giving internal detail about those methods and data.
·
Encapsulation-
Encapsulation is placing the data and the functions
that work on that data in the same place. While working with procedural
languages, it is not always clear which functions work on which variables but
object-oriented programming provides you framework to place the data and the
relevant functions together in the same object.
·
Inheritance-
One of the most useful aspects of object-oriented programming is
code reusability. As the name suggests Inheritance is the process of forming a
new class from an existing class that is from the existing class called as base
class, new class is formed called as derived class.
This is a very important
concept of object-oriented programming since this feature helps to reduce the
code size.
There are few types of inheritance,
which are as follows:
Single inheritance
Multi-level inheritance
Multiple inheritance\
Hierarchical inheritance
Hybrid inheritance.
No comments:
Post a Comment