Sanjivani Rural Education Society’s
Sanjivani College of Engineering, Kopargaon-423 603
(An Autonomous Institute, Affiliated to Savitribai Phule Pune University, Pune)
NAAC ‘A’Grade Accredited, ISO 9001:2015 Certified
Department of Computer Engineering
(NBA Accredited)
Subject- Object Oriented Programming (CO212)
Unit 1 – Fundamentals of OOP
Topic –1.1 Introduction to procedural, modular, object-
oriented and generic programming techniques
Prof. V.N.Nirgude
Assistant Professor
E-mail :
nirgudevikascomp@sanjivani.org.in
Contact No: 9975240215
Procedural Programming
⦿With procedural programming, you are
able to combine sequences of calling
statements into one single place.
⦿A procedure call is used to invoke
the procedure. After the sequence is
processed, flow of control
proceeds right after the position
where the call was made .
Main
Program
Procedure
DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 2
Procedures
DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 3
⦿Using procedures programs can be written more
structured and error free.
⦿For example, if a procedure is correct, every time it is used it
produces correct results.
⦿Consequently, in cases of errors you can narrow your search to
those places which are not proven to be correct.
Procedure Program View
⦿Now a program can be viewed as a sequence of procedure calls.
⦿The main program is responsible to pass data to the individual calls,
the data is processed by the procedures and the resulting data is
presented back to main program.
⦿Thus, the flow of data can be illustrated as a hierarchical graph
or a tree.
Main Program
Data
Procedure1 Procedure2 Procedure3
DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 4
Modular Programming
DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 5
⦿Modular programming is subdividing your program into
separate subprograms such as functions and subroutines.
⦿With modular programming, procedures of a common
functionality are grouped together into separate modules.
⦿A program therefore no longer consists of only one single part.
It is now divided into several smaller parts which interact
through procedure calls and which form the whole program.
Main Program
Data
Data
Module2
+
Data2
Data
Module1
+
Data1
Procedure1
Procedure2 Procedure3
DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 6
⦿ Each module can have its
own data. This allows each
module to
internal state
modified by
manage an
which is
calls to
procedures of this module.
⦿ Each module has its own
special functionalities
that supports the
implementation of the
whole program.
Modular Programming
Object Oriented
Programming
DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 7
⦿ Build programming using software objects.
⦿ Means that we organize software as a collection of discrete
(different) objects that incorporate both data structure and
behavior.
⦿ In OOP
, an object correspond closely to real objects involve
in the application area.
⦿Everything in the world is an object..like a flower, a tree, an animal,
a student, a chair, a building, a city, a country, a subject such as
CS, Math, History etc.
Object1
Data1+Procedures1
Object3
Data3 + Procedures3
Object2
Data2 + Procedure2
Object4
Data4 + Procedures4
DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 8
Object Oriented Languages
DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 9
⦿An object-based programming language is one
supports object-orientation.
⦿Smalltalk:1972-1980, Alan Kay
⦿C++:1986, Bjarne Stroustrup
⦿Java:1992 (Smalltalk + C++), James Gosling
⦿C#:Developed at Microsoft by Anders Hejlsberg, 2000
which easily
Generic programming
DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 10
• Generic programming is a style of computer programming in which
algorithms are written in terms of types to-be-specified-later that are
instantiated when needed for specific types provided as parameters.
• Generic programming makes developers’ life easier by giving us the
ability to write code once and reuse it across different types in a
typesafe manner. The majority of strongly typed languages support
generic programming.
Code for swaping of integer values:
void Swap(int a, int b)
{
int temp = b;
b = a;
a = temp;
}
Generic Code for swaping of any type of
values:
template <typename T>
void Swap(T& a, T& b)
{
T temp = b;
b = a;
a = temp;
}
Generic Code illustration with
Example
DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 11
Thankyou…
DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 12

1.1 Introduction to procedural, modular, object-oriented and generic programming techniques.pdf

  • 1.
    Sanjivani Rural EducationSociety’s Sanjivani College of Engineering, Kopargaon-423 603 (An Autonomous Institute, Affiliated to Savitribai Phule Pune University, Pune) NAAC ‘A’Grade Accredited, ISO 9001:2015 Certified Department of Computer Engineering (NBA Accredited) Subject- Object Oriented Programming (CO212) Unit 1 – Fundamentals of OOP Topic –1.1 Introduction to procedural, modular, object- oriented and generic programming techniques Prof. V.N.Nirgude Assistant Professor E-mail : nirgudevikascomp@sanjivani.org.in Contact No: 9975240215
  • 2.
    Procedural Programming ⦿With proceduralprogramming, you are able to combine sequences of calling statements into one single place. ⦿A procedure call is used to invoke the procedure. After the sequence is processed, flow of control proceeds right after the position where the call was made . Main Program Procedure DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 2
  • 3.
    Procedures DEPARTMENT OF COMPUTERENGINEERING , SCOE,KOPARGAON 3 ⦿Using procedures programs can be written more structured and error free. ⦿For example, if a procedure is correct, every time it is used it produces correct results. ⦿Consequently, in cases of errors you can narrow your search to those places which are not proven to be correct.
  • 4.
    Procedure Program View ⦿Nowa program can be viewed as a sequence of procedure calls. ⦿The main program is responsible to pass data to the individual calls, the data is processed by the procedures and the resulting data is presented back to main program. ⦿Thus, the flow of data can be illustrated as a hierarchical graph or a tree. Main Program Data Procedure1 Procedure2 Procedure3 DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 4
  • 5.
    Modular Programming DEPARTMENT OFCOMPUTER ENGINEERING , SCOE,KOPARGAON 5 ⦿Modular programming is subdividing your program into separate subprograms such as functions and subroutines. ⦿With modular programming, procedures of a common functionality are grouped together into separate modules. ⦿A program therefore no longer consists of only one single part. It is now divided into several smaller parts which interact through procedure calls and which form the whole program.
  • 6.
    Main Program Data Data Module2 + Data2 Data Module1 + Data1 Procedure1 Procedure2 Procedure3 DEPARTMENTOF COMPUTER ENGINEERING , SCOE,KOPARGAON 6 ⦿ Each module can have its own data. This allows each module to internal state modified by manage an which is calls to procedures of this module. ⦿ Each module has its own special functionalities that supports the implementation of the whole program. Modular Programming
  • 7.
    Object Oriented Programming DEPARTMENT OFCOMPUTER ENGINEERING , SCOE,KOPARGAON 7 ⦿ Build programming using software objects. ⦿ Means that we organize software as a collection of discrete (different) objects that incorporate both data structure and behavior. ⦿ In OOP , an object correspond closely to real objects involve in the application area. ⦿Everything in the world is an object..like a flower, a tree, an animal, a student, a chair, a building, a city, a country, a subject such as CS, Math, History etc.
  • 8.
    Object1 Data1+Procedures1 Object3 Data3 + Procedures3 Object2 Data2+ Procedure2 Object4 Data4 + Procedures4 DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 8
  • 9.
    Object Oriented Languages DEPARTMENTOF COMPUTER ENGINEERING , SCOE,KOPARGAON 9 ⦿An object-based programming language is one supports object-orientation. ⦿Smalltalk:1972-1980, Alan Kay ⦿C++:1986, Bjarne Stroustrup ⦿Java:1992 (Smalltalk + C++), James Gosling ⦿C#:Developed at Microsoft by Anders Hejlsberg, 2000 which easily
  • 10.
    Generic programming DEPARTMENT OFCOMPUTER ENGINEERING , SCOE,KOPARGAON 10 • Generic programming is a style of computer programming in which algorithms are written in terms of types to-be-specified-later that are instantiated when needed for specific types provided as parameters. • Generic programming makes developers’ life easier by giving us the ability to write code once and reuse it across different types in a typesafe manner. The majority of strongly typed languages support generic programming.
  • 11.
    Code for swapingof integer values: void Swap(int a, int b) { int temp = b; b = a; a = temp; } Generic Code for swaping of any type of values: template <typename T> void Swap(T& a, T& b) { T temp = b; b = a; a = temp; } Generic Code illustration with Example DEPARTMENT OF COMPUTER ENGINEERING , SCOE,KOPARGAON 11
  • 12.
    Thankyou… DEPARTMENT OF COMPUTERENGINEERING , SCOE,KOPARGAON 12