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

Programming and Problem Solving Lecture - 3-Introduction To Object Oriented Programming Programming Paradigm

The document discusses different programming paradigms including monolithic, procedural, structured, functional, logic-based, and object-oriented programming. It provides details on each paradigm such as their core concepts, advantages, and disadvantages. Object-oriented programming focuses on data as a critical element, ties data closely to functions, and protects data from accidental modification, making programs more robust.

Uploaded by

atharva soman
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views

Programming and Problem Solving Lecture - 3-Introduction To Object Oriented Programming Programming Paradigm

The document discusses different programming paradigms including monolithic, procedural, structured, functional, logic-based, and object-oriented programming. It provides details on each paradigm such as their core concepts, advantages, and disadvantages. Object-oriented programming focuses on data as a critical element, ties data closely to functions, and protects data from accidental modification, making programs more robust.

Uploaded by

atharva soman
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

PROGRAMMING AND PROBLEM SOLVING

LECTURE – 3- INTRODUCTION TO OBJECT ORIENTED


PROGRAMMING
PROGRAMMING PARADIGM

Prepared By :
Pallavi S Joshi
PROGRAMMING PARADIGMS
Introduction

 A programming paradigm is a fundamental style of computer programming.


 Compared with a software development methodology, which is a style of
solving specific software engineering problems.
 Different methodologies are more suitable for solving different kinds of
problems or applications domains.
 Same for programming languages and paradigms.
 Programming paradigms differ in:
 the concepts and abstractions used to represent the elements of a program (such as objects,
functions, variables, constraints, etc.)
 the steps that compose a computation (assignation, evaluation, data flow, control flow,
etc.).
 Some languages are designed to support one particular paradigm
 Smalltalk supports object-oriented programming
 Haskell supports functional programming

 Other programming languages support multiple paradigms


 Object Pascal, C++, C#, Visual Basic, Common Lisp, Scheme, Perl,
Python, Ruby, Oz and F#.

 The design goal of multi-paradigm languages is to allow programmers to


use the best tool for a job, admitting that no one paradigm solves all
problems in the easiest or most efficient way.
Introduction to Various Programming Paradigms

To comprehend how languages are constructed, one needs to look in to more details.
The four basic computational models that describe most programming today are :
1) Imperative or procedural Language
2) Applicative or functional Language
3) Rule based or logic Language
4) Object oriented Language
5) Monolithic
6) Structured
Monolithic Programming
Programs written using monolithic programming languages such as assembly
language and BASIC consist of global data and sequential code. The global data
can be accessed and modified (knowingly or mistakenly) from any part of the
program, thereby, posing a serious threat to its integrity.
Monolithic programs have just one program module as such programming
languages do not support the concept of subroutines. Therefore, all the actions
required to complete a particular task are embedded within the same
application itself. This not only makes the size of the program large but also
makes it difficult to debug and maintain.
Procedural Programming
In procedural languages, a program is divided into n number of subroutines that access
global data. To avoid repetition of code, each subroutine performs a well-defined task. A
subroutine that needs the service provided by another subroutine can call that subroutine.
Therefore, with ‘jump’, ‘Go To’, and ‘call’ instructions, the sequence of execution of
instructions can be altered.
Advantages
• The only goal is to write correct programs.
• Programs were easier to write as compared to monolithic programming.
Disadvantages
• Writing programs is complex.
• No concept of reusability.
• Requires more time and effort to write programs.
• Programs are difficult to maintain.
• Global data is shared and therefore may get altered (mistakenly).
Structured Programming
Structured programming, also referred to as modular programming.
Advantages
Efficient, correct programs that are easy to understand, debug and change.
• Modules enhance programmer’s productivity.
Many programmers can work on a single, large program
• A structured program takes less time to be written than other programs. • Each module
performs a specific task.
• Each module has its own local data.
First to introduce the concept of functional abstraction.
Disadvantages
• Not data-centered.
• Global data is shared and therefore may get inadvertently modified.
• Main focus on functions.
Object Oriented Programming (OOP)
 The major motivating factor in the invention of object-oriented approach is to remove some of the flaws
encountered in the procedural approach.

 OOP treats data as a critical element in the program development and does not allow it to flow freely around the
systems.

 It ties data more closely to the functions that operate on it, and protects it from accidental modification from
outside functions.

 OOP allows decomposition of a problem into a number of entities called objects and then builds data and functions
around these objects.

 The data of an object can be accessed only by the function associated with that object.

 However, functions of one object can access the the functions of other objects.
11
Some of the  striking features of object-oriented programming are

•Emphasis is on data rather than procedure.

•Programs are divided into what are known as objects.

•Data structures are designed such that they characterize the objects.

•Data is hidden and cannot be accessed by external functions.

•Objects may communicate with each other through functions.

•New data and functions can be easily added whenever necessary.

•Follows bottom-up approach in program design. 12

You might also like