Coding

Types of Programming Languages

This post discusses the primary types of programming paradigms most commonly utilized when building real world applications and solving complex problems following an organized and systematic approach

Types of Programming Pardigms

There are 2 primary categories of programming approaches and most of the programming languages can be broadly classified into one of these categories based on their features and usage model. These two major programming paradigms are as follows:

Imperative Programming

This type of programming paradigm focuses on the following aspects of programming:

  1. Given a problem statement, how to efficiently solve the problem. This could be specified as a set of steps that could be executed to find a solution to the problem.
  2. As a result of the above approach, this programming model results into a well defined set of control flow statements thereby producing a FSM (Finite State Machine).
  3. This is more commonly used in programming of most real world software and applications.
  4. Some common examples of programming languages that utilize the imperative programming paradigm are C programming language.

Declarative Programming

This type of programming paradigm focuses of the following aspects of programming:

  1. Given a problem statement, it focuses on what to solve instead of how to solve it. This could be specified as a series of mathematical evaluations called in order to extract the desired result from a given set of input.
  2. This programming paradigm does not employ the specification of a set of ordered steps to achieve the results, and thus lacks a control flow graph as well as well defined states during execution.
  3. This is less popular due to its complex syntax and need of expertise in the programming language.
  4. These are usually very efficient in solving a problem and involve lesser code as compared to imperative programming languages.
  5. Few areas where functional programming is used in real world applications are artifical intelligence and data modeling.
  6. Some common examples of programming languages that utilize the declarative programming paradigm are Haskell & Scala.

What is Procedural & Functional programming?

Procedural programming

This is a subset of imperative programming and is most commonly seen in the modern day languages that are designed to perform imperative programming. As the name suggests, the set of ordered instructions or commands executed to obtain the results can be structured in the form of procedures, hence the term procedural programming.

Functional programming

This is a subset of declarative programming and majority of the modern day declarative programming languages support functional programming. As the name implies, the mathematical evaluations performed to obtain the desired results from a given set of inputs are invoked in the form of function calls that are often pure functions.

Can a programming language be both Imperative & Declarative?

Yes, as a matter of fact, some of the most popular programming languages in the world combine the features and benefits of both Imperative & Declarative programming paradigms. For eg. Both C++ and Python are considered multi-paradigm programming languages because they support features of both Procedural & Functional programming.

Discussion & Comments