What is programming paradigms? Explain about different paradigms for problem solving.

Estudies4you

Different paradigms for problem solving, Need for OOP Paradigm

Q11. What is programming paradigms? Explain about different paradigms for problem solving.
Answer : 

Programming Paradigms
A programming paradigm is defined as a pattern or model of programming that includes the complete process of programming. It provides solutions to the problems within the framework. It involves a set of conceptual patterns that helps the user to generate an appropriate solution to a problem. There exists several programming paradigms and the programming techniques provided by each paradigm differs from one another. Whenever a solution is obtained using a programming paradigm, it is necessary to have a programming language to implement that process. Thus, every high level programming language consists of a programming paradigm. ;
Programming Paradigms for Problem Solving
The following are the mostly used programming paradigms,
(a) Imperative or procedural paradigm
(b) Functional paradigm
(c) Logical paradigm
(d) Object oriented paradigm.

(a) Imperative or Procedural Paradigm
Procedure oriented programming is a traditional programming paradigm which makes use of various high-level languages such as C, COBOL and FORTRAN. It consists of a set of functions. In this programming, a problem can be divided into a set of tasks. Each task can be performed by a function. A function consists of a set of instructions to perform the-required task. Along with these functions, main function is also available in this programming. The main function often consists of several instructions and the flow of execution starts from this function. The organization of procedure oriented programming is performed using a control flow which is as follows:
Explain about different paradigms for problem solving in c++,What is programming paradigms in c++,define Programming Paradigm in c++,Programming Paradigms for Problem Solving in c++,The Structure of Procedure Oriented Programming,Imperative or Procedural Paradigm in c++,Functional paradigm in c++,Logical paradigm in c++,Object oriented paradigm in c++,Advantages of Procedural Paradigm in c++,Disadvantages of procedural paradigm in c++,Disadvantages of Functional Paradigm in c++,Advantages of Functional Paradigm in c++.Logical Paradigm in c++,advantages of Logical Paradigm in c++,disadvantages of Logical Paradigm in c++,Object Oriented Paradigm,
Figure: The Structure of Procedure Oriented Programming
Generally, functions are operated depending on the variables that are available in the program. Among these variables and functions, a relationship exist. A function may contain its own variables/data called as local variables/local data. These variables can be used only within the function. If two or more functions are intended to use similar variables, then they can be declared as
global variables which can be used by any function available in the program. It is also called as imperative paradigm.
Advantages of Procedural Paradigm
  • It is more efficient and popular paradigm.
  • It is familiar than other paradigms.
Disadvantages of procedural paradigm
  • Debugging process is difficult.
  • It doesn’t maintain proper sequential format.

(b) Functional Paradigm
Functional programming paradigm is a paradigm used for evaluating the expressions. These expressions are evaluated based on mathematical function composition. It mainly focuses on “what to solve” rather than “how to solve”. Here, every expression that is evaluated generates a value. This paradigm is based on lambda calculus. The lambda calculus function adds “I to its parameter as shown below,
(lambda (x) (+ x1))
The above lambda calculus function can be represented in mathematical function as,
f(x) =x+1
The functional programming paradigm does not Support step-by-step execution. Here, the output of one expression is given as the input to the succeeding expressions.
Advantages of Functional Paradigm:
  • It eliminates the errors by decreasing the number of steps.
  • It makes the functional oriented programming languages easy.
  • It holds many referential transparency programs, therefore it is capable of receptive to mathematical proof and analysis.
Disadvantages of Functional Paradigm:
  • It has less efficiency.
  • It’s processing speed is very slow because of its larger size.

(c) Logical Paradigm
A logical paradigm (or) rule based paradigm is the one in which the primary means of making computations is done by applying logical relations to given parameters. It can be either a variable (or) a character. It mainly focuses on predicate logic, wherein ‘relation’ is the basic concept. It is an enhanced technique of functional paradigm.
Example
X is the father of Y: Y is the brother of Z. Then X can be the father of Z also.
Every logical paradigm consists of three phases in order to solve the given problem.
  1. In the first phase of the given problem, a series of declarations (or) assertions need to be checked.
  2. Then, check whether the given statements are relevant.
  3. After checking, finally write the suitable query to execute the given problem.
Advantages of Logical Paradigm
  • It reduces the number of steps in the program as it solves the problem logically by the system itself.
  • It easily proves the validity of the given problem.
Disadvantages of Logical Paradigm
  • It consumes a lot of time to execute certain tasks.
  • It is very difficult to debug an error.

(d) Object Oriented Paradigm
Object oriented programming is an enhanced technique of procedure oriented programming. It is introduced to overcome the problems of procedure oriented programming. In actual terms, procedure oriented programming uses top-down approach. Whereas, object oriented programming uses bottom-up approach. It also reduces the complexities of procedure oriented programming.
The object oriented programming technique develops a program with a set of objects along with a well-defined interfaces to that object. A brief definition of an object oriented programming is that it is a data which controls the access to code. This technique also discusses about the way in which elements in a computer program must be organized and how these elements can interact with each other. To perform this, object-oriented programming uses various principles such as inheritance, data abstraction, encapsulation and polymorphism.
Advantages of Object Oriented Paradigm
  • It is capable of visualizing the solutions to the given problems easily.
  • Its encapsulation allows the objects to adapt and reuse the different programs.
Disadvantages of Object Oriented Paradigm
  • It requires more memory
  • It requires more processions resources.
To Top