DEV Community

Ajay
Ajay

Posted on

About a Programming Paradigm

It is the idea, model or fundamental style of solving problem using programming language,It porvides the structured approach or set of principle that make the programs to design and implement,

  • Different programing language uses different paradigm techniques to solve the problem.

  • A programming language used one or more paradigm , to make an best approach for the project requirement.

There Different Types of paradigm approach,

1. Imperative Paradigm

It will focus on step by step instrcution to machine , should complete the task , we can specify the operation and work flow of control during the execution

let num = [1,2 ,3 ,4 ,5];
let total = 0;

for(i =0;i<num.length;i++){
     total = total + num[i];
}

console.log(total);
Enter fullscreen mode Exit fullscreen mode

- Procedural Programming paradigm
It will ogranizes a program into the procedural and function which will perform the specify task

- Object Oriented programming
object oriented program will ogranizes the program into class and objected structure, the object will contain data and methods

- Parallel Processing Approach
It will perform the multiple operation at the same time , usually it use multiple cpu core and computer resources.will increase the efficieny of the program

2. Declarative Paradigm

It will focus on what the result we want rather than the specifying every steo required.

let numbers = [10, 20, 30, 40];

console.log(sum(numbers));

Output:

100
Enter fullscreen mode Exit fullscreen mode

- logic Programming Paradigm
Logic programming expresses problems through facts, rules and logical relationships. A system uses those rules to determine answers.

- Functional Programming
Functional programming builds programs using functions that transform inputs into outputs. It often emphasizes pure functions, immutable data and avoiding unnecessary side effects.

- Database Processing Approach
Database processing often uses declarative queries to describe the data we want to retrieve or modify in the database.

Top comments (0)