Notes Chapter-06

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

1

LESSON – 6
OBJECT ORIENTED CONCEPTS

1) Structured Programming
An organized approach to programming involving the use of three basic control structures –
sequence, branch, and loop and the use of top-down concepts to decompose main functions
into lower level components for modular coding purposes.
Characteristics of Structured Programming (Procedure Oriented Programming)
 Emphasis is on procedure rather than data.
 Large programs are divided into smaller programs known as functions.
 Data is not hidden and can be accessed by external functions.
 Data may communicate with each other through functions.
 Most of the functions share global data.
 Data move openly around the system from function to function.
 Functions transform data from one form to another.
 Follows top-down approach in program design.

2) Object Oriented Programming


Object-oriented modeling and design is a new way of thinking about developing solutions
using models organized around real-world concepts. The fundamental construct is the
object, which combines both data and behavior in a single entity.
Characteristics of Object Oriented Programming
 Emphasis is on data rather than procedure.
 Programs are divided into what are known as objects.
 Data is hidden and cannot be accessed by external function.
 Objects may communicate with each other through function.
 Data structures are designed such that they characterize the objects.
 Functions that operate on the data of an object are ties together in the data
structure.
 New data and functions can be easily added whenever necessary.
 Follows bottom up approach in program design.

Difference between Procedural Programming and Object Oriented Programming:


PROCEDURAL ORIENTED PROGRAMMING OBJECT ORIENTED PROGRAMMING

In procedural programming, program is divided In object oriented programming, program is


into small parts called functions. divided into small parts called objects.
Procedural programming follows top down Object oriented programming
approach. follows bottom up approach.
There is no access specifier in procedural Object oriented programming have access
programming. specifiers like private, public, protected etc.
Adding new data and function is not easy. Adding new data and function is easy.

F:\PUC\PUC_I\NewSyllabus\Notes_Chapter-6.docx
2

Procedural programming does not have any Object oriented programming provides data
proper way for hiding data so it is less secure. hiding so it is more secure.
In procedural programming, overloading is not Overloading is possible in object oriented
possible. programming.
In procedural programming, function is more In object oriented programming, data is
important than data. more important than function.
Procedural programming is based on unreal Object oriented programming is based
world. on real world.
Examples: C, FORTRAN, Pascal, Basic etc., Examples: C++, Java, Python, C# etc.

3) Basic Concepts of Object Oriented Programming


 Objects
An object is a collection of data members and associated member functions. Each
object is a collection of data name. Every object must be a member of a particulars
class.
 Classes
A class is a collection of objects that have the identical properties, common
behavior, and shared relationship. A class binds the data and its related functions
together.

 Data abstraction
Data abstraction permits the user to use an object without knowing its internal
working. Abstraction refers to the process of representing essential features without
including background details or explanations.

 Data encapsulation
Data encapsulation combines data and functions into a single unit called class.
Data encapsulation will prevent direct access to data. The data can be accessed only
through methods (function) present inside the class. The data cannot be modified by
an external non-member function of a class. Data encapsulation enables data hiding or
information hiding.

 Inheritance
The concept of inheritance provides the idea of reusability. This means that we
can add additional features to an existing class without modifying it. Thus the process of
forming a new class from an existing class is known as Inheritance. The objects of one
class acquire the properties of another class through inheritance. The existing class in
known as base class. The new class is known as derived class.

 Overloading
Overloading allows objects to have different meaning depending upon context.
There are 2 types of overloading

F:\PUC\PUC_I\NewSyllabus\Notes_Chapter-6.docx
3

a) Operator overloading
When an existing operator operates on new data type, it called operator
overloading.
b) Function overloading
Function overloading means two or more functions have same name, but differ
in the number of arguments or data types of arguments. Therefore it is said that
(function name) is overloaded.

 Polymorphism
Polymorphism s a feature of object oriented programming where a function can
take multiple forms based on the type of arguments, number of arguments and data
type of return value. The ability of an operator and function to take multiple forms is
known as polymorphism.

 Dynamic binding
Binding is the process of connecting one program to another. Dynamic binding
means code associated with a procedure call is known only at the time of program
execution routine.

 Message passing
Communication between objects takes place using message passing. It involves
specifying the object name, the name of the function (message) and information to be
sent.

4) Advantage of OOP
 The programs are modularized based on the principle of classes and objects.
 Linking code & object allows related objects to share common code. This reduces code
duplication and code reusability.
 Data is encapsulated along with functions. Therefore external non-member function
cannot access or modify data, thus providing data security.
 Easier to develop complex software, because complexity can be minimized through
inheritance.
 The concept of data abstraction separates object specification and object
implementation.
 Creation and implementation of OOP code is easy and reduces software development
time.
 OOP can communicate through message passing which make interface description with
outside system very simple.
 Smaller programs can be developing in a short span of time.
 The modules can be shared by a number of applications.

F:\PUC\PUC_I\NewSyllabus\Notes_Chapter-6.docx
4

5) Limitation of OOP (Disadvantage of OOP)


 OOP software is not having set standards.
 The adaptability of flow diagrams and object oriented programming using classes and
objects is a complex process.
 To covert a real world problem into an object oriented model is difficult.
 The classes are overly generalized.

6) Application of OOP
Object oriented programming approach is an easier method to design and implement
programs. The programs are easier to upgrade and modify. The standard class libraries can
be used by the programmers so that development time is minimized.
 Computer graphic applications.
 CAD / CAM software.
 Object Oriented Database.
 Object Oriented Distributed Database
 User interface design such as windows.
 Real-time systems
 Simulation and Modeling
 Artificial intelligence and expert systems.
 Hypertext, Hypermedia.
 Client Server System.

*****

F:\PUC\PUC_I\NewSyllabus\Notes_Chapter-6.docx

You might also like