The World of Programming Paradigms

Search for a command to run...

This is a good attempt and is a fairly good read. However Iβm a little confused as to how you have presented database programming as a paradigm. It really isnβt itβs a domain specific focus for regular programming whether oop , functional or both. As a functional programming (which is a paradigm) advocate I attempt to apply the principles to whatever solution i a, writing whether itβs database or not.
Certainly you could express database programming as an approach itself since it may use specific languages like SQL but the language does not determine the form of approach (OOP, FP etc) only the way to use the language. Yes SQL is a highly imperative language but that doesnβt make it OOP , nor can it be declared a paradigm.
Many modern languages are OO proficient which is basically merely a way to describe things like type inference, inheritance and polymorphism. Such is the dna of OOP. However it is also possible to use the same languages to apply the functional paradigm principles even though the language itself may not be FP orientated. (Java, JavaScript, Python, for example. )
Saying that you provide a good basic overview but In places I think there is a tad over thinking. Still an enjoyable read.
Thanks, Suprahba π
I glad you liked it π€©
Thanks Tapas
Thanks π
With the rise of AI agents, vibe coding, and the advancement of software development tools, it's never been easier to build applications quickly. However, these advancements come at a cost to software

Personal highlights along with Work highlights in 2024

π‘ Originally posted here. In the intricate world of web design today, typography serves as a powerful means of expression, improving site usability and it goes beyond the realms of font choice and sizes. In this article weβll explore a sub-section...

Ever spent hours wrestling with images that refuse to stay put in your web layouts? You're not alone. In this comprehensive guide, we will unravel the mystery behind different image centering methods, from the basic and widely used to the more advanc...

Tailwind CSS recently launched some awesome updates in v3.4, supporting CSS features like Dynamic viewport units, subgrid supports and other features, which we'll go over in this article. It's so easy to be carried away by using the already-known fea...

There are so many ways of writing programs, either by the programming language of choice or by the different features of a language. Understanding this fact will help you write more efficient programs if you ask me π.
So, in this article, I'll be sharing what are programming paradigms and mentioning a few of the paradigms we have out there in the world of programming and also reasons to use a particle paradigm.
"The world of programming paradigms" - From the statement, the words can be broken down into three, which are "World", "Programming" and "Paradigms".
Let's know what these words mean:
Programming: From the word programming, there's another word - program, so what's a program.
A program is a set of instructions used to solve/perform a specific task/problem.
With the word program being defined, now what's programming?
Programming is simply the act of writing programs.
Paradigms: are a set of concepts, thought patterns used in a domain/field.
So, Programming Paradigm can be thought of like a way/style of writing programs. Also, it can be viewed as ways programs are classified based on their features.
There are so many programming paradigms out there, developed to solve problems and implemented in all programming languages like Java, C, JavaScript, etc. Due to the numerous paradigms, we are looking at just the two most common paradigms in this article.
Note: Programming Paradigms doesn't refer to a particular programming language but rather the way of writing programs in that programming language.
Click here to view most of the Programming paradigm that exist.
Before proceeding further, you should know that mostly all recently used programming languages are multi-paradigm, meaning they can be written using not just one but as many paradigms supported in the language.
There are two common programming paradigms, which are:
Both programming paradigms can further be divided as shown in the image below:

Note: There're more subdivisions to the Imperative programming paradigm and the Declarative programming paradigm, but we'll be concerned about the subdivisions shown in the image for this article.
Firstly, what's the meaning of the word, Imperative?
Imperative could mean something vitally important, crucial or an act of giving an authoritative command.
So, therefore, In an Imperative Programming Paradigm, the order of steps is crucial, because the next step is mostly dependent on the previous step.
Here's an example in JavaScript to demonstrate my point:
let sum = 0
sum+= 1 // sum = sum + 1
sum+= 2 // sum = sum + 2
sum+= 3 // sum = sum + 3
console.log(sum) // 6
From the snippet above, we notice that the variable sum is initialised with the value 0.
Then the next couple of line is dependent on the current value of the variable sum which sums up to 6.
From Imperative Programming Paradigm, other styles of writing programs were also derived and for this article, we'll be looking at two sub-modules which are Procedural programming and Object-Oriented programming
Procedural programming is derived from the Imperative Programming Paradigm, which allows splitting of instructions into procedures also is concerned about the series of instructions to concur whereby each step relies on the previous step.
Procedural programming is much more like an iterative approach to solving a task/problem using loops (for, while) and if statements for control flow.
Here's an example to find the sum of numbers from 0 to 10, written in JavaScript:
let sum = 0
for (let i = 0; i <= 10; i++) {
sum+= i
}
console.log(sum) // 55
From the snippet of code above, a for loop that iterates from 0 to 10 adding the previous sum variable with i and then the final output of the variable sum will be 55.
Some major procedural programming language includes Fortran, ALGOL, BASIC and Pascal but more examples are found here List of programming languages by type - Procedural languages
In Object-Oriented Programming, the concept of classes and objects are used. The paradigms specialise in modularity, breaking real-world entities into objects that can be reused.
Also, Object-Oriented Programming is based on the concept of objects where an object contains data/fields (attributes) and methods (behaviours).
Some key characteristics of the OOP are:
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
}
class Student extends Person {
constructor(name, age, matricNo, level) {
super(name, age)
this.matricNo = matricNo;
this.level = level;
}
getStudenDetails() {
return `${this.name} is of age ${this.age},
his Matric Number is ${this.matricNo} and his in ${this.level}L`
}
}
const student1 = new Student('Favourite', 18, 'RUN/CMP/18/7796', 300)
console.log(student1.getStudenDetails())
// outputs
// 'Favourite is of age 18, his Matric Number is RUN/CMP/18/7796 and his in 300L'
From the snippet of code above, a class Person was first declared with its data/attributes as name and age. Also, the Person class is known as the Superclass because another class extends its properties.
Next off, another class was declared as Student, this class extends all the properties of the Person class because all students are also a person and this brings about inheritance.
Declarative programming is a style of building programs that express the logic of a computation without talking about its control flow.
From the word, Declarative; it means an announcement / a statement, so in this paradigm, the instructions that are to be carried out are declared meaning it doesn't need to be explicitly defined with how the instruction is to be meant done but just what is meant to be done.
Imagine being asked to draw a rectangle on a book, an imperative approach would state the various procedures like drawing two parallel lines on both axes while a declarative approach would just state the end goal and doesn't care about the process takes.
So the main differences are that imperative tells you how to do something and declarative tells you what to do.
Declarative Programming also has some programming languages beneath it, we'll be looking at Functional Programming and Database Programming.
The functional programming paradigm is rooted in using mathematical operation, it's a way of writing programs elegantly like you'll think of when thinking about a problem.
Also, Functional programming is the process of solving problems by composing pure functions, avoiding shared state, mutable data, and side effects. Functional programming is declarative rather than imperative, and application state flows through pure functions
Terms like: Recursion, Memoization, Pure Function, Composition are used along with Functional Programming.
Let's say, a Fibonacci problem is to be solved, using a Functional approach makes the problem easier to solve and think about.
Each Fibonacci number is defined as the sum of the previous two Fibonacci numbers, so fibonacci(n) = fibonacci(n-1) + fibonacci(n-2). By convention, the first two numbers are fixed: fibonacci(0) = 0 and fibonacci(1) = 1.
Here's the Functional approach of solving a Fibonacci problem using JavaScript.
function recursiveFibonacci(n) {
if ( n <== 0) return 0
if ( n === 1) return 1
return recursiveFibonacci(n-1) + recursiveFibonacci(n-2)
}
recursiveFibonacci(6) // 8
Note, there some caveat to Functional Programmings, like the Memory Stackoverflow, but there are also solutions to this caveat like Tail Call Optimation
Read this wonder article to know more about Functional Programming: Master the JavaScript Interview: What is Functional Programming?
A database is an organized collection of structured information, or data, typically stored electronically in a computer system. A database is usually controlled by a database management system (DBMS).
To process the data and querying them, databases use tables. Data can then be easily accessed, managed, modified, updated, controlled and organized.
Most databases use Structured Query Language (SQL) for writing and querying data.
There're three major parts to Database Programming:
Read this article to know more about Databases: What is a Database? - edureka
Below, are simple declaration and schema declaration on what should be in a data show be in a database.
CREATE DATABASE Students;
CREATE TABLE ComputerScienceStudent (
MatricID int,
LastName varchar(25),
FirstName varchar(25)
);
I'm pretty sure in some ways, directly or indirectly you've written programs using the combinations of all the Programming paradigms mentioned above, probably without your knowledge. Well, know you know some of the most used programming paradigms and reasons to use them.
I hope you found the article useful, thanks for reading!