What Is A Programming Paradigm?
Introduction
Since the release of the first high-level programming language, Plankalkül, and the resulting release of languages like FORTRAN and Common Lisp, programming languages have been pushing the envelope of what programming can be and what types can mean to a computer programmer. Often this is done through what is called a programming paradigm.
A programming paradigm is a concept to which the methodology of a programming language adheres to. Paradigms are important because they define a programming language and how it works. A great way to think about a paradigm is as a set of ideas that a programming language can use to perform tasks in terms of machine-code at a much higher level. These different approaches can be better in some cases, and worse in others. A great rule of thumb when exploring paradigms is to understand what they are good at. While it is true that most modern programming languages are general-purpose and can do just about anything, it might be more difficult to develop a game, for example, in a functional language than an object-oriented language.
Declarative vs Imperative
Probably the most hilarious thing about the concept of programming paradigms is that the paradigms themselves are sub-classed like C++ just came out yesterday. Usually, in programming methodology, there are two significant categories that a language will fall into:
Declarative
Imperative
Declarative Programming
Declarative programming is when the programmer behind the wheel isn’t effectively programming exactly what a computer does at any given moment — but instead describes properties of the result they want while not explaining how to compute it. Some examples of paradigms that fall into this window are:
The functional programming paradigm.
The logical programming paradigm.
The mathematical programming paradigm.
The modular programming paradigm.
Imperative Programming
Imperative programming is essentially the opposite of declarative programming. Firstly, with imperative programming, the user is typically interacting directly with the state of the computer, and deciding how things are to be calculated. Some examples of paradigms that popularized this method of programming are:
The object-oriented programming paradigm.
The procedural programming paradigm.
Paradigm applications
It is important to remember that languages do not need to conform to these rules. Although C++ is often wrongfully credited with creating the object-oriented programming paradigm, it certainly did bring one amazing concept into play in the programming world:
Generics!
Generics allow programming languages to pick-and-choose certain attributes from various programming paradigms and utilize the ones that might apply best to the application of the language. Prior to the introduction of generics, most languages were created to perform very specific operations. For example, Simula, the real first object-oriented programming language was created specifically for running complex simulations. Another great example is COBOL, which is a programming language mostly used in business applications.
Most modern programming languages are multi-paradigm programming languages. This is because the added support of generic programming concepts makes it possible for programming languages to flow across the paradigms and effectively change how they work in what is sometimes some very cool ways.
Given that most modern programming languages are multi-paradigm, some might wonder why it is important to know so much about all of the paradigms. This is a valid question to ask, as the lines between paradigms are so irrelevant in a lot of languages — my favorite, Julia, comes to mind — why should you be familiar with the properties of each paradigm, rather than just picking up a single multi-paradigm language? My counter-argument is this:
Education.
I watched a great interview that Lex Friedman (love that guy) did with Bjarne Stroustrup (the legend who made C++) where Bjarne Stroustrup went into a lot of detail on answering this very question. Here is an embedded version you can listen to now if you are interested:
In the interview, he goes on to say that a great programmer should know at least five programming languages. While these don’t necessarily need to be low-level at all, they should ideally be from different paradigms. The simple reality is that there is a lot about programming — and computers, in general — that a functional programming language can teach you. This is of course true with imperative languages such as C, object-oriented languages like Python and C++, and even stranger paradigms like the structural programming paradigm.
Here is a list of languages that I like and know that could teach you about programming in their respective paradigm:
Functional
Common Lisp
Scheme
Haskell
R
Julia
Nimrod
Object-oriented
C++
Java
JavaScript
Python
Scala
Imperative
C
Assembly (I personally use NASM/FASM and only the 64-bit registries (amd64 Assembly))
FORTRAN
I do formally suggest diving into some of these options if you have the desire to bring awareness beyond the bounds of one specific way to programming. A lot of the concepts might also come back in the long run, also, which is great. There is nothing like reinforcing a new skill or thing that you learned into your old code to make it better.
Classifying Languages
One could explain how all of the puzzle pieces of programming languages fit together, but a better approach might be to apply the knowledge already possessed in order to draw lines to different factors in code. As with most high-level programming concepts historically, we should start with C.
C
C is an imperative programming language. Using this language, one will often draw pointers and be moving data manually to figure out a programming problem. Although this gives a lot of control over the system, it also means that there is a lot more to watch out for, meaning that C is probably not the most ideal language to do quick arithmetic in.
C++
C++ is also an imperative language, as it is essentially a direct linking child to C. C++ also swoops into the object-oriented programming paradigm, being one of the most classic examples of such a language that is still used today.
Common Lisp
Lisp is an inherently functional programming language, however modern Lisp in most forms are no longer purely functional. This is a recurring theme over programming languages, as it doesn’t make very much sense at all for a language to only be good at one thing directly anymore.
R
R is another language that resides on the multi-paradigm spectrum. R is primarily a functional programming language, but of course takes advantage of generics and methodology that allows it to do more than most typical functional languages might be hard to enjoy the spoils of.
Julia
Julia is certainly a hard one to talk about in this regard. One thing that is unique about Julia is the methodology behind the language itself. However, in pure, basic forms, Julia is a functional programming language. Of course, like R Julia is a multi-paradigm language, but also takes the meaning of the word to a whole new level with multiple dispatches.
Rust
Rust is another great example of a multi-paradigm programming language. Although Rust is a lot like a more high-level C, it also has a lot of properties that would typically be considered functional in definition — which isn’t such a bad thing.
Python
It is likely we all know that Python is an object-oriented programming language first and foremost. However, Python is another completely multi-paradigm programming language.
Conclusion
All programming paradigms have their benefits to both education and ability. Functional languages historically have been very notable in the world of scientific computing. Of course, taking a list of the most popular languages for scientific computing today, it would be obvious that they are all multi-paradigm. Object-oriented languages also have their fair share of great applications. Software development, game development, and graphics programming are all great examples of where object-oriented programming is a great approach to take.
The biggest note one can take from all of this information is that the future of software and programming language is multi-paradigm. It is unlikely that anyone will be creating a purely functional or object-oriented programming language anytime soon. If you ask me, this isn’t such a bad thing, as there are weaknesses and strengths to every programming approach that you take, and a lot of true optimization is performing tests to see which methodology is more efficient or better than the other overall. This also puts a bigger thumbtack into the idea that everyone should know multiple languages from multiple paradigms. With the paradigms merging using the power of generics, it is never known when one might run into a programming concept from an entirely different programming language!
Last updated
Was this helpful?