For some, it’s a surprise to discover there are in fact closer to 700 programming languages in the wild. Now, to be fair, that includes obsolete, deprecated, obscure, and joke languages built out of boredom or to prove a point. But even if we filtered them out, we would still have plenty of ways to write code.
In most cases, a language is created to solve a problem. For example, PHP started as a set of tools created by a single developer to handle their personal webpages. With time, the tools grew and finally coalesced into the web development juggernaut that PHP is today. Python was designed as a successor to ABC that would focus on simplicity and readability. Java was designed from the ground up with object-oriented programming in mind. Dig enough and you’ll find that every language tells an interesting story.
You might’ve heard people classifying languages into different groups, like high or low level, dynamic or static, and programming or scripting. The latter case is the one I want to focus on today. Understanding the differences will give us key insights into the value of each of our projects.
What Is a Computer Language?
At its most basic, a computer language is a set of rules that facilitate communication between humans and computers. It’s a bridge that allows us to give computer instructions. There are different languages for different purposes. For example, command languages are used to control the tasks of the computer itself, such as starting programs, and query languages are used to make queries in databases and information systems.
Computers don’t understand language like we do. If I yell at a CPU “What’s 2+2?” it can’t understand me (and people will probably look at me funny). Beneath the user interface information is being processed in terms of 0 and 1, binary data. This is what we call machine code. In theory, a human with enough effort and willpower could potentially understand what those 0s and 1s mean, but for most of us, it’s simply impossible.
So, much like a visitor to a different country who hires the services of a translator, we use computer languages as a way to translate our intent into machine code. These languages can be subdivided into levels depending on how close they are to their machine counterpart. For summary purposes, we’ll divide them into 2 levels:
- Human language
- High-level languages
- Low-level languages
- Machine code
The prime example of a low-level language is Assembly, or asm, in which each statement equals 1 machine instruction. In other words, the engineer has absolute control over how the information is handled. While performance-wise low-level languages are unbeatable, writing code is often difficult and time-consuming.
High-level languages, on the other hand, tend to be closer to human language. Case in point, even non-programmers can read and get a rough idea of what a python code is trying to accomplish. Unfortunately, these languages tend to be slow in comparison to their low-level brethren.
Programming vs. Scripting
When we talk about programming languages, we are often referring to languages that are used to build software from scratch—just to mention the most popular examples, we have, C, C++, C#, Rust, and Java. What they all have in common is that these languages are compiled. In other words, once you finish writing your program, you translate it into machine code (or a similar low-level alternative) so it can be executed at once.
Scripting languages, on the other hand, are used to manipulate, customize, and automate the facilities of an existing system. For example, let’s say I want to write a script (a set of computer instructions) that downloads data from the web and saves it automatically on my hard drive. I don’t have to write new software to do it, just give instructions to what I already have.
Unlike compiled languages, scripted languages are often interpreted. In other words, another software reads the code line by line during execution and translates it into machine code, returning an error if it finds a problem with a line.
When To Use One or the Other
While high-level languages can write programs, not every program should be written with one. Performance-wise, complex software requires low-level solutions that focus on economy and efficiency. To be fair, most basic apps can be written and run in a language like Python without worrying about performance. Yes, it might be a thousand times slower than C++, but that’s the difference between 0.01 seconds and 0.00001 seconds. Slower, yes, but we won’t ever notice it.
Now, game engines for example have to run millions of calculations per minute. Go watch any Pixar movie. Every character, every texture, and every light was calculated by a computer—these are the cases where every millisecond counts. Likewise, operating systems that manage software directly have, by their nature, to be compiled into machine code, something that interpreted languages can’t simply do.
If you are creating something that’s meant to manipulate an existing system, then you are going to be using a scripting language. If you are going to build software, you can use either a high-level or low-level programming language. You could even use both, writing some parts in C or Assembly and letting Python handle the rest.
High-level languages and scripting languages are easier to use, faster to debug, and more user-friendly—that’s their main strength. Low-level languages are powerhouses capable of doing a lot more but require more expertise.