21CSC101T - OBJECT ORIENTED DESIGN AND
PROGRAMMING (Unit 1)
Introduction
Object Oriented Programming
OOP is a programming paradigm / model that organizes software
design around data or objects rather than functions
Object is a basic unit of OOP, It can be defined as data field that has
unique attributes and behavior.
Aims to implement real world entities like inheritance, hiding, polymorphism etc in
programming
Bind data and functions together
Functions associated with the data object can only access this data, No other part of code
can access
Code reusable - easily maintain and modify existing code
Object Oriented Design
It is the process of using an object oriented methodology to design a computing system or
application
Provides a system of interacting objects for the purpose of solving a software problem
Comparison of Procedural and Object-Oriented Programming
Procedure Oriented/ Structure
S.No Object Oriented Programming
Programming
1. It follows top down approach. It follows bottom up approach.
Program is divided into small parts Program is divided into small parts called
2.
called functions objects.
3. function is more important than data. data is more important than function
There is no access specifier in have access specifiers like private, public,
4.
procedural programming. protected etc.
It is less secure than OOPs. Because Data hiding is possible, hence more secure
5.
no data hiding. than procedural.
Data moves freely within the system In OOP, objects can move and communicate
6.
from one function to another. with each other via member functions.
, overloading is not possible. Overloading is possible in object oriented
7.
programming.
No inheritance. inheritance is present in object-oriented
8.
programming.
There is no code reusability. Adding It offers code reusability by using the
9. new data and function in POP is not so feature of inheritance. OOP provides an easy
easy. way to add new data and function.
10. Does not Supports Polymorphism Supports Polymorphism
11. Does not Supports Virtual Functions Supports Virtual Functions
Examples: C, FORTRAN, Pascal, Examples: C++, Java, Python, C# etc.
12.
Basic etc.
OOPS and its features
1. Objects
2. Classes
3. Encapsulation
4. Data abstraction
5. Polymorphism
6. Inheritance
7. Dynamic binding
8. Message passing
1. Objects:
Basic unit of Oops
Instant of a class
Run time entity
Has object name, data(attributes), Methods(functions)
Student Colour
Name price
Roll no
Mark Getdata()
Getmark() Process()
Get Result()
Car
Page No.2
,2. Class
Template or blueprint that describes the object
Has class name, attributes (data members), Methods
Memory is allocated at run time when object created
Student
Name
Roll no
Mark
Getmark()
Get Result()
3. Encapsulation:
Wrapping of data and functions together as a single unit is known as encapsulation.
By default data is not accessible to outside world and they are only accessible through
the functions which are wrapped in a class.
prevention of data direct access by the program is called data hiding or information
hiding
Page No.3
, 4. Data abstraction:
Data abstraction provides /exposes only essential features (like interface details) and hides
background details (Implementation details).
Class use the concept of data abstraction so they are called abstract data type (ADT)
5.Polymorphism:
Polymorphism means the ability to take more than one form. For example, an operation have
different behavior in different instances. The behavior depends upon the type of the data used
in the operation.
Polymorphism comes from the Greek words “poly” and “morphism”. “poly” means many and
“morphism” means form i.e.. many forms.
6.Inheritance:
Inheritance is the process of creating new classes by deriving the properties and
characteristics from another existin class.
It helps realize the goal of constructing software from reusable parts, rather than hand
coding every system from scratch.
When the class child, inherits the class parent, the class child is referred to as derived
class (sub class) and the class parent as a base class (super class).
In this case, the class child has two parts:
- a derived part and an incremental part.
- The derived part is inherited from the class parent.
- The incremental part is the new code written specifically for the class child.
7. Dynamic binding:
Binding refers to linking of procedure call to the code to be executed at the run time.
CSE Page No.4
PROGRAMMING (Unit 1)
Introduction
Object Oriented Programming
OOP is a programming paradigm / model that organizes software
design around data or objects rather than functions
Object is a basic unit of OOP, It can be defined as data field that has
unique attributes and behavior.
Aims to implement real world entities like inheritance, hiding, polymorphism etc in
programming
Bind data and functions together
Functions associated with the data object can only access this data, No other part of code
can access
Code reusable - easily maintain and modify existing code
Object Oriented Design
It is the process of using an object oriented methodology to design a computing system or
application
Provides a system of interacting objects for the purpose of solving a software problem
Comparison of Procedural and Object-Oriented Programming
Procedure Oriented/ Structure
S.No Object Oriented Programming
Programming
1. It follows top down approach. It follows bottom up approach.
Program is divided into small parts Program is divided into small parts called
2.
called functions objects.
3. function is more important than data. data is more important than function
There is no access specifier in have access specifiers like private, public,
4.
procedural programming. protected etc.
It is less secure than OOPs. Because Data hiding is possible, hence more secure
5.
no data hiding. than procedural.
Data moves freely within the system In OOP, objects can move and communicate
6.
from one function to another. with each other via member functions.
, overloading is not possible. Overloading is possible in object oriented
7.
programming.
No inheritance. inheritance is present in object-oriented
8.
programming.
There is no code reusability. Adding It offers code reusability by using the
9. new data and function in POP is not so feature of inheritance. OOP provides an easy
easy. way to add new data and function.
10. Does not Supports Polymorphism Supports Polymorphism
11. Does not Supports Virtual Functions Supports Virtual Functions
Examples: C, FORTRAN, Pascal, Examples: C++, Java, Python, C# etc.
12.
Basic etc.
OOPS and its features
1. Objects
2. Classes
3. Encapsulation
4. Data abstraction
5. Polymorphism
6. Inheritance
7. Dynamic binding
8. Message passing
1. Objects:
Basic unit of Oops
Instant of a class
Run time entity
Has object name, data(attributes), Methods(functions)
Student Colour
Name price
Roll no
Mark Getdata()
Getmark() Process()
Get Result()
Car
Page No.2
,2. Class
Template or blueprint that describes the object
Has class name, attributes (data members), Methods
Memory is allocated at run time when object created
Student
Name
Roll no
Mark
Getmark()
Get Result()
3. Encapsulation:
Wrapping of data and functions together as a single unit is known as encapsulation.
By default data is not accessible to outside world and they are only accessible through
the functions which are wrapped in a class.
prevention of data direct access by the program is called data hiding or information
hiding
Page No.3
, 4. Data abstraction:
Data abstraction provides /exposes only essential features (like interface details) and hides
background details (Implementation details).
Class use the concept of data abstraction so they are called abstract data type (ADT)
5.Polymorphism:
Polymorphism means the ability to take more than one form. For example, an operation have
different behavior in different instances. The behavior depends upon the type of the data used
in the operation.
Polymorphism comes from the Greek words “poly” and “morphism”. “poly” means many and
“morphism” means form i.e.. many forms.
6.Inheritance:
Inheritance is the process of creating new classes by deriving the properties and
characteristics from another existin class.
It helps realize the goal of constructing software from reusable parts, rather than hand
coding every system from scratch.
When the class child, inherits the class parent, the class child is referred to as derived
class (sub class) and the class parent as a base class (super class).
In this case, the class child has two parts:
- a derived part and an incremental part.
- The derived part is inherited from the class parent.
- The incremental part is the new code written specifically for the class child.
7. Dynamic binding:
Binding refers to linking of procedure call to the code to be executed at the run time.
CSE Page No.4