When we talk about the programming we mainly focus on languages and codes but an important part of writing good code or selecting the correct programming language for the problem we are working on is to understand the language itself. In this article, we will discuss the different types of Programming Paradigm which are present in programming.
Let us first understand the meaning of Programming Paradigm, it may sound something difficult but it simply is a division of languages based on how they work. There are mainly 4 types of paradigm: 
Let’s see an example to understand the difference between Imperative and Declarative Programming. Suppose you are trying to build a house, if you go to your engineer and tell him how many rooms you want and where you want them then you will come under a declarative programming paradigm. On the other hand, if you tell your engineer that you should follow these particular steps (e.g. build a wall here etc.) and then my house will be built then you will come under imperative programming.


Declarative paradigm expresses what to do.
Imperative paradigm expresses how to do it.
In an imperative language, we declare each and every step which needs to be done, like in C where we go with the logical flow of the program and write that down in steps.
In declarative language, we just specify what we want and the languages under the hood do the work for us and bring us the result. In SQL we just write which entries we need from a table and then it directly gives us the result, we do not specify how it should search in a table or anything else.
Imperative languages, in general, are easy to understand as the flow is clear to programmers but have long code. Flow in declarative languages isn’t that clear and therefore is difficult to debug but as we just mention steps the code length is short.
Note: All the programming paradigms are not necessarily disjoint, the same language may follow traits from two different paradigms.
I hope now you got a clear idea about both programming paradigms. Comment down below if you have any queries.
A crazy computer and programming lover. He spend most of his time in programming, blogging and helping other programming geeks.
source

Categories: CodingProgramming