What is a programming paradigm?

What is a programming paradigm?

ยท

2 min read

A programming paradigm is a concept to which the methodology of a programming language adheres. In more simple words, a programming paradigm is a style, or way, of programming. Paradigm can also be termed as a method to solve some problem or do some task.

A look at some major paradigms

Usually, in programming, there are two significant categories that a language will fall into:

  • Imperative

  • Declarative

Imperative programming

The imperative programming paradigm assumes that the computer can maintain through environments of variables any changes in a computation process. Computations are performed through a guided sequence of steps, in which these variables are referred to or changed. The order of the steps is crucial because a given step will have different consequences depending on the current values of variables when the step is executed. Some examples of paradigms that popularized this method of programming are:

  • The object-oriented programming paradigm

  • The procedural programming paradigm

Declarative programming

Declarative programming is a style of programming in which programs describe their desired results without explicitly listing commands or steps that must be performed. In other words, the approach focuses on what needs to be achieved instead of instructing how to achieve it. Some examples of paradigms that fall into this window are:

  • The functional programming paradigm

  • The logical programming paradigm

  • The mathematical programming paradigm

Object-oriented programming paradigm

Object-oriented programming (OOP) is a programming paradigm based on the concept of objects, which can contain data and code: data in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods). The key characteristics of object-oriented programming include Class, Abstraction, Encapsulation, Inheritance, and Polymorphism. Many languages support the OOP, like:

  • Python

  • Ruby

  • C++

  • C#

  • Java

Functional programming paradigm

In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that map values to other values, rather than a sequence of imperative statements which update the running state of the program. Many languages support the functional programming paradigm, like:

  • Haskell

  • Scala

  • Clojure

  • Go

  • Perl

Conclusion

Programming paradigms reduce the complexity of programs. Every programmer needs to follow a paradigm approach when coding. If you use a paradigm, your code will be reusable, easy to debug, readable, and easy to maintain and improve. However, each one has its advantages and disadvantages, so choose a programming paradigm is an important step for developers, to achieve the result.

ย