dcsimg

Types of Programming Languages

If you know the history of programming languages, you are probably familiar with the name Ada Lovelace. If not, she is credited with creating the first-ever programming language back in 1883, at the behest of mathematician Charles Babbage. Known as the "Algorithm for the Analytical Engine," Lovelace's "language" predated modern computers by almost a century. To contrast that, the first-ever low-level programming language - also known as a machine language, wouldn't appear until 1949. This would be followed several years later by the first-ever mainstream developer languages, which went by the monicker, Autocode.

Today, some of the old-time computer languages are still in use. Two examples of this are Fortran - known as formula translation - which was created back in 1957 for statistical analysis, mathematics, and scientific calculations. COBOL - short for Common Business Oriented Language - is still used by insurance companies despite the fact that it was released back in 1959. A more commonly used language - C - was introduced in 1972.

High Level versus Low Level versus Assembly Programming

Low-Level programming languages are what you think of when you see old science fiction movies where computers are as big as a car and have a bunch of beeping lights on them. They are languages that offer no abstraction from hardware and issue instructions to machines - or computers - in the form of 0s and 1s, which, essentially, act as on and off switches. Low-level languages come in two forms: Machine language and Assembly language.

Machine-level programming languages are made up of binary (0 and 1) sets of instructions that computers are able to "understand" without the need of a "translator." Here is an example of the popular "Hello, World!" program if you were to write it in a machine-level language:

01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100

A step up from machine-level language is Assembly language, which incorporates more human, English-like syntax. Assembly requires a "translator" known as an assembler to translate the code for the computer to be able to understand the instructions the developer is issuing. Another difference is the fact that Assembly level language has hardware abstraction, whereas machine-language does not.

Here is an example of "Hello, World!" written in Assembly (example provided by https://montcs.bloomu.edu/Information/LowLevel/Assembly/hello-asm.html):

org 0x100

mov dx, msg
mov ah, 9
int 0x21
mov ah, 0x4C
int 0x21
msg db 'Hellom World!', 0x0d, 0x0a, '$'

As you can see, it is a little more readable than the machine-level sample, but just barely.

High-level programming languages more closely resemble human language and are what most modern languages are considered to be today. They, unlike their predecessors, are not machine-dependent, meaning you can write them for any type type of computer. This is known as portability. They are much easier to write (as you can imagine), read and maintain.

Examples of high-level programming languages include such notables as Python, Perl, Java, and C#. The following is an example of how you would write the "Hello, World!" application using a high-level language - in this instance, Python:

print("Hello, World!")

Which would result in the following output:

Hello, World!

Different Types of Programming Languages

Now that we have looked at the different levelsof programming languages, we can delve deeper into the different types of developer languages and break them down into categories. For all intents and purposes, there are five main programming language types; one could argue that more exist, but most modern languages fall into one of the following categories: functional, procedural, Object-oriented programming (OOP), scripting, and logic (or logical).

Functional Programming Languages

Functional programming languages take the approach of software development using strictly functions. They avoid the principles of Object-oriented languages and steer clear of the execution of statements, relying, instead, on declarations and expressions. Output, therefore, relies on arguments that get passed to functions.

Some popular functional programming languages include Clojure, F#, Scala, and SQL.

Here is an example of the "Hello, World!" app written in the functional programming language, F#:

open System

[]
let main argv =
    printfn "Hello World from F#!"
    0 // return an integer exit code

Procedural Programming Languages

Procedural programming languages depend upon procedure calls, which issue instructions to a computer or device in a step-by-step, logical manner. They use top-down approaches, treating information and procedures as two separate elements. Programs are divided into procedures, routines, and functions (all of which are technically the same thing), which carry the steps of instructions for the machine to execute.

Some popular procedural programming languages include C, C++, Go, Perl, and Python.

Here is an example of the "Hello, World!" app written in the procedural programming language, C:

#include <stdio.h>

int main()
{

	printf("Hello, World!");

	return 0;
}

Object-Oriented Programming (OOP) Languages

Object-oriented programming (OOP) languages are among the most popular languages in the world. The concept of OOP can be difficult to grasp at first glance, but once a programmer learns it, they tend to prefer it. OOP uses classes and objects to structure programs. These objects and classes act as blueprints and reusable pieces of code for software creation. Classes act as the framework or blueprint upon which instances of objects are created. You could think of a class as a broad representation of a car. Classes contain attributes that get passed onto the objects that are created from them.

In this example, the car class could contain attributes like color, engine type, number of doors, and so forth. When an object is created from that class, it inherits these attributes.

Some popular object-oriented programming languages include C#, Python, Kotlin, and VB.Net.

Note: A few notes before continuing. By now, you may have noticed that some languages - such as Python - fall under more than one category of programming language type. A programming language, for instance, can be procedural and object-oriented at the same time.

Also, some languages can contain elements of a programming language type. A prime example of this is Java, which is often referred to as an OOP language. However, that is not quite true. Java does contain elements of OOP. However, it also uses primitive data types, which are not a feature of a true object-oriented programming language.

Here is an example of the "Hello, World!" app written in the object-oriented programming language, Kotlin:

fun main(args: Array) {
	println("Hellow, World!")
}

Scripting Languages

The main difference between scripting languages and other programming languages is the fact that scripting languages do not need to be compiled. This means that they are interpreted at runtime. Scripting languages are written in a manner in which - typically - commands are interpreted one at a time by a piece of software or a scripting engine. Another difference is that the execution of these scripts is handled by the runtime environment versus by the scripting language.

Scripting languages, as an aside, are not the same as markup languages, which include HTML and XML. Nor are scripting languages the same as stylesheets, such as CSS.

Some popular scripting languages include JavaScript, PHP, Bash, and VBA.

Here is an example of the "Hello, World!" script written in the scripting language, JavaScript:

Here is some text that would appear before our JavaScript.


Here is some text that displays after the JavaScript pop-up!

In this example, we mix JavaScript inside of HTML. The first thing that happens when this page loads is that the sentence "Here is some text that would appear before our JavaScript." appears on the screen. Next, our JavaScript gets executed, which, in this case, triggers a pop-up alert that states: "Hello, World!". After the JavaScript is executed, the rest of the HTML on the page is rendered in the user's browser.

Here, again, note that the Internet Browser triggers and executes the JavaScript - there is no call for the JavaScript to execute itself.

Logical Programming Languages

Logical programming languages are used to create programs in which statements are written to express facts and rules pertaining to problems. An example of this can be seen in the way that a logic program might be programmed. For instance, a rule could be written as a logical clause using headers and a body, similar to: "A is True if B, C, and D are False." Facts meanwhile can be written in the same way, but without having a body: "A is True."

Some popular logic programming languages include Prolog, Datalog, and F-logic. Programming examples using logic programming languages are, unfortunately, beyond the scope of this article.