A brief approach to programming paradigms

  • En el mundo de la informática podemos encontrar lenguajes de programación para todos los gustos.
  • Claro que no depende de nuestro gusto la elección de un lenguaje u otro, sino del contexto en el que se vaya a utilizar.
  • La forma de hacer las cosas cambia cada día más rápido en la informática y, como hemos visto, también muchos lenguajes de programación se adaptan a nuevas formas de hacer las cosas.

In the world of Computer Science, we can find programming languages to suit all tastes. Of course, the choice of one language or another does not depend on our taste, but on the context in which it is to be used. Implementing a facial recognition system is not the same as developing a RESTful API… However, there are not only different programming languages that we can choose depending on each situation, but also different programming paradigms. In this post we’ll take a brief look at what each of these paradigms consists of.

What is a programming paradigm?

A programming paradigm has been defined as a “technological proposal adopted by a community of programmers and developers whose central core is unquestionable in that it only attempts to solve one or several clearly delimited problems”. In plain language, we can define a programming paradigm as the way in which the computing tasks should be carried out to achieve the objectives. It may also be understood as a style of programming, although the previous definition would be more exact. There are many types of paradigms, and in the following sections we are going to see those that are more important today.

Imperative paradigm

This is the paradigm that tends to be used the most. It is based on the sequential execution of orders that are interpreted by a compiler and carried out in order, in this way changing the state of the programme. Languages that use this type of paradigm are the programming languages CJava and Python.

Declarative paradigm

Whereas in the imperative paradigm, the instructions that should be executed to reach a solution are specified; in the declarative paradigm, instructions that describe the solution of the problem are used. They are internal mechanisms that try to solve the problem thanks to the sentences that the user has introduced. Some languages use this model of programming; the best known are HaskellLISP and Prolog.

Functional paradigm

This type of programming is within the declarative paradigm and is mainly based on the use of mathematic functions. The positive part of functional programming is that we cannot reach an inconsistent state of the programme. Whereas in the other paradigms already described a function can change the general state of the programme, in the functional paradigm the result of a function is generated exclusively from the arguments that it provides itself. Additionally, this programming paradigm is not exclusive to a group of languages but can also be included in the other paradigms. An example of this can be found in the Python and JavaScript languages. Despite being imperative languages, they are able to execute code that is characteristic of functional programming.

Object-oriented paradigm

Object-oriented programming became popular in the early 1990s. In this paradigm, the programmes attempt to approach reality more by encapsulating concepts. In this way, each “entity” in the programme consists of an object with its own attributes and functions. Therefore, the programme works by interacting with objects that reach their own states. The most important languages that belong to this paradigm are JAVAC++ and Ruby. However, like in the other paradigms, many languages have evolved so that they are also able to use the type of characteristics that this paradigm provides.

This post has tried to explain very superficially some of the most important programming paradigms today. But this does not mean they are the only ones. In computer science the situation is changing faster and faster every day and, as we’ve seen, many languages adapt to the new ways of doing things.


Author 64cae3931f

More posts by 64cae3931f