0% found this document useful (0 votes)
5 views

Chapter 1 Principles of OOP Theory

The document provides an overview of the evolution of programming languages from machine language to fifth-generation languages used in Artificial Intelligence. It contrasts Procedure Oriented Programming (POP) and Object Oriented Programming (OOP), highlighting their characteristics, limitations, and key principles such as data abstraction, inheritance, polymorphism, and encapsulation. OOP is emphasized for its modular approach and data protection, while POP is noted for its focus on functions and global data sharing.

Uploaded by

Agam Stories
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Chapter 1 Principles of OOP Theory

The document provides an overview of the evolution of programming languages from machine language to fifth-generation languages used in Artificial Intelligence. It contrasts Procedure Oriented Programming (POP) and Object Oriented Programming (OOP), highlighting their characteristics, limitations, and key principles such as data abstraction, inheritance, polymorphism, and encapsulation. OOP is emphasized for its modular approach and data protection, while POP is noted for its focus on functions and global data sharing.

Uploaded by

Agam Stories
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

INTRODUCTION TO OBJECT ORIENTED PROGRAMMING CONCEPTS

EVOLUTION OF PROGRAMMING LANGUAGE: -


First Generation Programming Language: - First programming language used
by the programmers is regarded as machine language. Machine language
instructions are expressed as binary numbers called machine code. A binary
number is made up of two digits – zero (0) and one (1).
Second Generation Programming Language: - Assembly language is regarded
as a second-generation language. Assembly language uses symbolic
operations called mnemonics. Ex ADD- used to add to data values, SUB- used
to subtract two data values, MOV- used to move data from one location to
other etc.
Third Generation Programming Language: - A third generation language is
close to English in vocabulary. Writing programs in these languages is much
easier than using their predecessors. These languages are easier to read and
require less time to write programs. Third generation programming languages
are high level programming languages such as FORTRAN, Cobol, Pascal etc.
Fourth Generation Programming Language: - A fourth generation language is
closer to a real-world language and non-procedural language. Data based
languages such as SQL, Oracle, Python are examples of fourth generation
languages.
Fifth Generation Programming Language: - The fifth-generation languages are
mainly used in Artificial Intelligence. Smalltalk, Prolog and Mercury are
examples of the fifth-generation languages. Fifth generation language directly
understand human beings (people able to talk to computers.

You have already learnt High-Level languages those are designed by the expert
people (programmer). These languages are machine independent. We can
develop and understand program logic without having much knowledge about
Page | 1
UMESH COMPUTE KENDRA (PH: 9897188951)
the computer’s architecture. The programming style and context is easier to
learn and the entire code focuses on the specific program to be created. Every
single program written in a high-level language must be interpreted into
machine language before being executed by the computer.
BASIC, C, C++ and java are popular examples of high-level languages.
BASIC, COBOL, FORTRAN and C are commonly known as Procedure Oriented
Programming (POP). The procedure-oriented approach allows the users to
develop their logic by applying a number of functions that would enable
program productivity.
Here is a simple flow diagram is illustrated to depict the procedure
programming approach.

Procedure Oriented programming (POP) basically consists of making a list of


instructions for the computer to follow and organize these instructions into
groups, known as functions. In procedure-oriented programming, most of
function share global data and data move more openly around the system
from one function to other.
In this System the global data are loosely attached to the functions. They keep
floating through out the program. In Procedure Oriented programming
system, the emphasis is on functions rather than data Items.

Page | 2
UMESH COMPUTE KENDRA (PH: 9897188951)
Characteristics of Procedure Oriented Progamming: -
• Procedural Programming follows a top-down approach.
• The program is divided into blocks of codes classed functions.
• It is easy to follow the logic of a program.
• Emphasis is on functions.
• The data is moved freely in the program.
• Functions share global data.
Limitations of Procedure Oriented Programming: -
• Procedural programming mainly focuses on procedures or functions.
Less attention is given on data.
• As data values are global to all the functions, you may require to make
necessary changes in all the functions due to any change in the data
values.
• It is not suitable to solve complex problems in real situations.
• The data and functions are detected from each others.
• Limited and difficult code reusability.
OBJECT ORIENTED PROGRAMMING (OOP):
In object-oriented programming (OOP) is an approach to standardize the
programs by creating a partitioned memory area for both data and functions.
It does not allow data to flow freely from one function to another.
In this system, the complete problem is decomposed into a number of entities
called objects. Each object includes a set of data items and related functions.
Page | 3
UMESH COMPUTE KENDRA (PH: 9897188951)
The data values of an object are applicable only within the functions
associated with that object. The resident data can never be handled by
external functions.
In this way the data are protected and secured from being troubled by eternal
sources. Thus, allowing object-oriented feature to be a powerful tool for
programming. The organization of data and function in OOP can be illustrated
as:

The different Object-Oriented Programming Languages are C++, Java, Python,


Smalltalk, Ruby, Eiffel etc.
“An Object-Oriented Programming (OOP) is a modular approach, which allows
the data to be applied within stipulated program area. It also provides the
reusability feature to develop productive logic, which means to give more
emphasis on data.”
Features of Object-Oriented Programming (OOP): -
• It gives stress on the data items rather than functions.
• The program resulting from OOP is a collection of objects. Each object has
its own data and a set of operation.
• A properly defined class can be reused, giving way to code reusability.
• OOP restricts the free movement of data and the functions that operate
on it.
• It is highly beneficial to solve complex problems.
• OOP follows a bottom-up approach.

Page | 4
UMESH COMPUTE KENDRA (PH: 9897188951)
Limitations of Object-Oriented Programming: -
• Software developed using this approach requires a substantial amount of
pre-work and planning.
• Oops code is difficult to understand if you do not have the corresponding
class.
Differentiate between POP and OOP: -
Procedural Oriented Programming Object Oriented Programming
The stress is put on the function The stress is put on data rather than
rather than the data. the functions.
It allows data to flow freely The data is restricted to be used in a
throughout the program. specific program area.
It follows top-down programming It follows bottom-up programming
approach. approach.
Entire program is divided into Entire program is divided into
functions. objects.
Data and functions are separated. Data and functions are encapsulated
into a single entity called object.
Limited and difficult code reusability. Easy code reusability.

Example: C, COBOL and Pascal Example: Java, C++ and C#

DEFINE
Object: - It is unique entity, which contains data and functions (characteristics
and behaviour) together in an OOP language.
Real World Object: - The object that we experience or use in our day to day
life. Each real-world object contains characteristics and behaviour. The
characteristics basically referred as parts of its body or specifications. Whereas
behaviour as the purpose of its use or its function.
Page | 5
UMESH COMPUTE KENDRA (PH: 9897188951)
Software Objects: - A software object is created through java program. When
we compare a software object to real world object then the characteristics are
referred to as data members of software objects whereas behaviour of real-
world objects are compared with member functions of software objects.
Class: - Class is a template of objects. Each object of a class possesses some
characteristics and behaviours defined within the class. Thus, class is slao
referred to as a blue print or prototype of an object.

BASIC PRINCIPLES OF OBJECT-ORIENTED PROGRAMMING(OOP)


The object oriented programming (OOP) has following basic principles:-
• Data Abstraction
• Inheritance
• Polymorphism
• Encapsulation
DATA ABSTRACTION:
In real life situation, you might have noticed that we need not require to know
the details of the technologies to operate the system.
“Data Abstraction is the act of representing the essential features without
knowing the background details. It is always relative to the purpose or user.”
INHERITANCE:
You might have studied the term ‘Heredity’ in biology, which means the
transmission of genetically based characteristics from parents to the offspring.
Similarly, the object of a class acquires some properties from the objects of
another class. This is possible by deriving a new class from the existing class.
The new class will have combined features of both the classes.

Page | 6
UMESH COMPUTE KENDRA (PH: 9897188951)
The class gets inherited to another class is known as Base class or Super class
or Parent class. The class that inherits form a base class is known as Derived
class or Sub class or Child class.
“The term inheritance means to link and share some common properties of
one class with the other class. This can be done by extending the object of one
class into another class and using through it.”
POLYMORPHISM:
“Polymorphism is one of the Object-Oriented Programming (OOP) principles,
which supports function overloading. It is the process of using a function or
method for more than one purpose. The term function overloading is defined
as it has the same function name with different parameters.”
Thus, the function overloading is a process to create a number of functions or
methods with the same name but with different parameters.
ENCAPSULATION:
“One of the important features of Object-Oriented Programming is to restrict
the free flow of data from one object to another. The data and functions are
wrapped together in an object in such a way that the data of a particular object
can only be used in associated functions. The system of wrapping data and
functions into a single unit is known as Encapsulation.
Thus, encapsulation is helpful in an object-oriented programming in the
following ways:
1. The source code of an object could be maintained independently.
2. The object maintains privacy of the data members. However, the changes
that take place in methods don’t affect the other object.

Page | 7
UMESH COMPUTE KENDRA (PH: 9897188951)

You might also like