Header Ads Widget

Procedural Oriented Programming (POP): -

 Procedural Oriented Programming (POP): -

                            A program in a procedural language is a list of instruction where each statement tells the computer to do something. It focuses on procedure (function) & algorithm is needed to perform the derived computation.

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, COBOL, 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 Procedural oriented programming (structured programming): -
  •  Its emphasis on doing things. 
  •  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. 
  •  It is difficult to create new data types. The ability to create the new data type of its own is called extensibility. Structured programming languages are not extensible.
To overcome the limitation of Procedural oriented programming languages Object oriented
programming languages were developed.

Object Oriented Programming:
            The Object-Oriented Programming (OPPs) can be defined as a programming model that emphasizes or focus mainly an object. The Object-Oriented Programming considered data important rather than actions (functions).
 
             Features of OOP:
I. Emphasis on data rather than procedure.
II. Program are divided into what are known as objects.
III. Data structures are designed such that they characterize the objects.
IV. Follows bottom-up approach in program

Benefits of OPP:
I. OOP is faster and easier to execute.
II. OOP provides a clear structure for the programs.
III. Code reusable.
IV. Better to create GUI.

                             Difference Between C and C++:
 
C C++
C follows the procedure style
Programming.
C++ is multi-paradigm.
Data is less secured in c. In C++, we can use modifiers for
class to make it inaccessible for
outside users.
C follows top-down approach. C++ follows bottom-up approach.
C does not support function
overloading.
C++ supports function
overloading.

 

Object-Oriented Approach:
The Object-Oriented approach focus on capturing the structure and behaviour of
information system into small modules that combines both data and process. The main aim
of object-oriented programming is to improve the qualities and productivity of the system
analysis and design by making it more usable.
 
Basic Concepts of Object-Oriented Programming:
1. Class:
Class is collection of objects. It is logical entity.
The class is a model of an object that defines or specifies all the properties of the objects.
Objects with the similar meaning and purpose grouped as class. A class encapsulates the
data and behaviour of the objects.

2. Object:
An object is an entity or instance of a class. The objects are the mostly physical entity
(Student, Patients) but it can be a logical entity (Bank Account, Exam) as well. Each
Object has state and behaviour.
            Fig:- of object


3. Inheritance:
Inheritance is the process of acquiring or sharing the properties and behaviour of the
base class into the sub class to achieve reusable.
In OPP the concept of inheritance provides the ides of the reusability. This means that
we can ass additional features to an existing class without modifying it. This possible by
deriving a new class from existing one. The new class will have the combined feature of
the both classes. 
                Fig:- of object
4. Polymorphism:

                Polymorphism means the ability to take more than one form. An operation
may exhibit different behaviour depends upon the types of data types. For
Example: Consider the operation of addition. For two numbers the operation
will generate as sum. If operand are Strings, then the operation will produce
third string by concatenation.

5. Encapsulation:
                The encapsulation is the process of grouping or wrapping up data and functions to perform actions on the data into the single unit. The single unit is called class.
Encapsulation is like enclosing in a capsule. That is enclosing the related operations
and data related to an object into that object. It keeps the data and the code safe from
external interfaces.
The main purpose or use of the encapsulation is to provides the security to the data of
the class.
To make the data secure we need to use the private access modifiers that will restrict the
access to the data outside the class. The class modifiers are used to define the access
level or scope of the class members like data members and functions.


 
6.Abstraction:
 
                Hiding internal details and showing functionality is known as abstraction. For example, phone call, we don't know the internal processing.