publication

What are Programming Paradigms?

Miquel Canal

Friday 12, March 2021

    What are Programming Paradigms?

    Programming paradigms are common ways to solve a problem using a set of techniques. They can be thought of as strategies of writing code to solve a challenge using a certain programming style or language.

    There are a vast variety of software languages and they can be classified into multiple programming paradigms. To classify a programming language as one paradigm, we can look at their execution model, their code organization or their syntax and grammar.

    In this article we are going to review the most common programming paradigms and list some examples of software languages on each paradigm.

    Imperative Programming Paradigm

    The imperative programming paradigm is based on assignment statements that change the internal state of a program. The execution of the program is done via step by step modifications to the program’s state.

    Imperative programming focuses on how the program is executed. It executes the assignments line by line as they are written. It is an explicit paradigm. This can be contrasted by the declarative programming paradigm which focuses on what the program has to accomplish.

    The imperative programming is a generic paradigm which includes the following paradigms:

    Declarative Programming Paradigm

    A declarative programming paradigm is an implicit style of programming. It focused on what the program has to execute rather than how to solve the problem. If in the imperative paradigm we describe the program’s execution line by line, in declarative programming we focus on telling what we want the program to execute.

    The key to declarative programming is that the language describes what are the final results we expect rather than the step-by-step commands to execute. A declarative program does not get involved in the logic behind scenes. That is why it is known as not to have side-effects.

    There are multiple paradigms that can be grouped inside the Declarative Programming Paradigm:

    Event Driven Programming Paradigm

    The Event Driven Paradigm is a programming style which creates programs that react to events in order to execute logic. The most common way of event driven programming is reacting to user inputs or clicks. Event-driven programs gain popularity due to the increase of mobile devices and web-applications with powerful front-end frameworks.

    At the core of an event-driven program there is a scheduler process that keeps track of the received events and forwards them into the respective event-handlers. The events are usually identified by IDs and they contain internal data of the event which can be retrieved by the logic reacting to the event. It is common for event-handlers to trigger other events, thus creating a chain reaction of events.

    Exceptions are usually raised by the event scheduler if it can’t find an event-handler or from the event-handler itself if the event data does not meet the expectations.

    It is common for the event scheduler process to receive multiple events simultaneously, this is where the event queue enters the play. An event queue allows multi-thread execution in a program and is responsible for queuing the events. Event queues ensure each event-handler receives event notifications. It also allows for managing event priority, meaning that certain events might take priority over others based on their type.

    Java and JavaScript are examples of languages that use event-driven programming.

    Additional Programming Paradigm

    This article has covered the most common programming paradigms. There are more paradigms related to programming. Here is a list to name a few:

    References

    How to Change Git User Name and Email

    How to Change Git User Name and Email

    Easy steps to configure a Git repository and change the Git user name and email. A review of git's config object and how to retrieve information from a git repository using the git config command.

    GDPR: General Data Protection Regulation

    GDPR: General Data Protection Regulation

    The basics of the new regulation law for user privacy and information security inside the EU.

    Top JavaScript Frameworks 2021

    Top JavaScript Frameworks 2021

    What are the top JavaScript Frameworks that you should be looking for in 2021? This article provides a list of the most commont frontend frameworks to use on a JavaScrtipt project.

    This site uses cookies to ensure a great experience. By continue navigating through the site you accept the storage of these cookies.