Your master sword: a programming language

Updated Oct 22, 2023 ⤳ 10 min read

A programming language is a specialized language used to give instructions to a computer to execute.

These instructions can be simple mathematical operations to elaborate algorithms.

What is an algorithm?

A set of instructions to solve a problem or perform a computation is called an algorithm.

It’s like a step-by-step clear-cut DIY recipe to solve a problem or to calculate a value.

Algorithms are described in a language-agnostic way to assure all programmers would understand them.

The most common way of describing algorithms is through pseudocodes.

Pseudocodes are usually a mix of the human language and known programming symbols to communicate the meaning more easily.

For example, the following pseudocode describes an algorithm, which determines whether a number is odd or even:


get a “number”
divide “number” by 2
if the remaining is equal to 0 
  print: It’s even
  print: It’s odd

You don’t have to write down a pseudocode every time you want to write a piece of code, though.

If the algorithm is simple, you can form it in your mind.

But if it’s complicated, and you want to discuss it with your teammates, then pseudocode is the way to go.

You can also find many algorithms that have been created for various problems by computer scientists, such as sorting algorithms, searching algorithms, etc.

In technical interviews, the interviewer might ask you to write a program, which involves a computer algorithm. 

Leetcode is a popular platform for practicing such programs when preparing for an interview.

Programming paradigms

There’s always more than one approach to do a job.

However, depending on the job, some approaches work better than others.

Programming is no different …

A programming paradigm is a way of programming in a programming language.

You usually choose a programming language based on what paradigm (programming style) you want to go with for a particular job.

There are two broad categories for programming paradigms: imperative and declarative.

Imperative paradigm

In an imperative programming paradigm, the programmer explicitly defines how to achieve a result – through a set of instructions.

For example, the following Python code calculates the square root of a number in an imperative style:


square_root = 10 ** (1 / 2)

As you can see, it is we who define how to calculate the square root.

In Procedural programming, programmers encapsulate repeated instructions into reusable units of code.

We call these reusable units subroutines or functions.

The programming language allows programmers to use these functions as many times as needed, so they won’t have to write the same instructions over and over.

In object-oriented programming, programmers encapsulate a group of functions – referred to as methods – and the data they work with into a bigger unit called an object.

Let’s make the concept clear with an example.

 Imagine you’re building a car racing game, where players can choose a range of cars to race.

Every car in the game has particular characteristics and behaviors.

For instance, players can change colors (characteristics) and control the car, including speeding up, breaking, going back, and turning left & right.

Let’s try to write this game as functions (without the actual code).

First, we write in a procedural style (don’t worry about the syntax, it’s just to give an idea of how it would look like):


// This function receives the car data and changes the color
function changeColor (carData, newColor) {
    carData.color = newColor

function move(carData)   { … }
function break(carData)     { … }
function rearGear(carData)  { … }
function turnRight(carData) { … }
function turnLeft (carData) { … }

// In procedural style data is kept separate from the behaviors
// First car
let car_ford = {  color: ‘red’}

// Second car
let car_dodge = {  color: ‘blue’}

// Let’s change the color of the first car
changeColor(card_ford, ‘purple’)

// Here we use the subroutine, passing the carData to move function so it can move the car
// or 

As you can see, in the procedural approach, the behaviors and individual car data are kept separate, and cars share the same functions.

In OOP, however, we package characteristics (carData) and behavior into a blueprint, and then we generate as many cars as we want based on that blueprint:


// This is our car blueprint, which is called a class
class Car {
constructor(defaultColor) {
this.color = ‘black’
// Default coordinates: start line    
this.locationCoordinates = [0, 0]

changeColor(newColor) {
this.color = newColor


// Functionalities  
move() {}
break () {}
turnLeft() {}
turnRight() {}

Now, we can produce cars based on this class:


let ford = new Car(‘purple’)
let dodge = new Car (‘black’)

// Now that we have the cars we can use their behaviors very easily


In the OOP style, we have a blueprint of a game character, containing the state (coordinates, color, etc.) and the behavior (moving, breaking, etc.).

Thanks to this blueprint, we can replicate as many characters as we want, and we won’t have to manage their state separately (like in procedural programming).

 In OOP, we encapsulate data and functionality into reproducible units.

The other benefit of OOP is inheritance.

Imagine we want to add a group of cars to the game that flies too!

To do that, we need to make a new blueprint for our flying cars.

However, since those are still cars, but with additional functionalities, we inherit those characteristics/behavior from the Car class:


// The FlyingCar class extending the Car class
class FlyingCar extends Car {
  // Additional functionalities besides the inherited ones
  takeOff() { }
  land() { }

Now, we have a blueprint to generate cars with flying ability.

And we can use it like so:


let super_car = new FlyingCar(‘white’)


You might be wondering why so many styles exist while we can use them interchangeably.

 Here’s the explanation:

Although we can use various programming paradigms for the same problem, some paradigms work better (and neater) in particular cases.

For example, in the above racing game example, OOP is a more versatile option.

Programming languages like C++, Java, Python, JavaScript, PHP, and Rust support imperative programming.

They also allow us to write in a declarative style too.

Such languages are known as multi-paradigm programming languages.

Declarative paradigm

Declarative-paradigm programming languages only allow the programmer to declare what to achieve rather than how it should achieve it.

On the other hand, the programmer has no control over the details of an operation.

For example, here’s how you’d calculate a square root of a number in the LISP language:


sqrt 9.0

As you can see, unlike Python, you can only say what you need, but you don’t have control over the calculation method.

SQL (Structured Query Language), Regular Expressions, HTML, XML, Prolog, Lisp support declarative paradigm.

The intended domain of use

Another way to classify programming languages is the intended domain of use, which categorizes programming languages into two main categories: Domain-Specific languages and General-Purpose languages and (DSL).

A DSL provides high-level specialized programming features to solve problems of a particular field or industry.

An example of a DSL is Matlab Programming language, which is primarily intended for numerical computing.

CSS and HTML can also be considered as DSLs.

In contrast to a DSL, a General-purpose language is a programming language that applies to a broader range of domains.

When people talk about a programming language, they usually refer to a general-purpose programming language.

Programming languages such as C++, Java, JavaScript, Python, Rust, PHP are considered general-purpose languages.

Which programming language should you learn?

It is probably the most asked question on social media these days: what programming language should I learn?

It depends on what you want to do.

But it’s easier to say which one to start with if you’re hunting for jobs.

Below is a list of the most popular general-purpose programming languages that will likely land you a job in a tech company:

The most popular languages
  1. JavaScript
  2. Java
  3. Python
  4. PHP
  5. Golang
  6. C#

Disclaimer: This post may contain affiliate links. I might receive a commission if a purchase is made. However, it doesn’t change the cost you’ll pay.