Grab a random software developer and ask them what language they are proficient with and odds are they will answer either C#, Python, or JavaScript. Keep digging and someone will mention PHP, Java, C++, or SQL (for some it’s a language, for others it’s not). Maybe you’ll find the odd developer who will talk about Clojure or Ruby. By odds alone, one would be tempted to think that there are about a few dozen programming languages, perhaps even a hundred.
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 web pages. With time, the tools grew and finally coalesced into the web development programming language 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 difference between scripting 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
Criteria | Scripting Languages | Programming Languages |
Definition | A type of programming language that automates tasks and controls other software | A set of instructions used to create software applications and control computer behavior |
Compilation | Interpreted at runtime, no need for compilation | Generally compiled into machine code before runtime |
Speed | Slower due to interpretation at runtime | Faster as the compiled code runs directly on the CPU |
Ease of Use | Generally easier to learn and use, often high-level with simple syntax | Can be low-level or high-level, with varying degrees of complexity |
Use Cases | Often used for web development, automation, text processing, etc. | Used for a wide range of applications, from operating systems to games |
Examples | JavaScript, Python, Ruby | C, C++, Java, Rust |
Interactivity | Often used for creating interactive aspects in web pages | May or may not have interactive capabilities depending on the language and the development environment |
File Organization | Often used in a standalone manner with single or few files | Large projects are typically organized into many files and directories |
Access to System Resources | Typically limited access to system resources for security reasons | Full access to system resources |
Error Checking | Errors are typically checked at runtime | Errors are typically checked during compilation |
Learning Curve | Easier learning curve due to high-level abstractions and simplicity | Steeper learning curve, especially for low-level languages |
Integration | Often used to glue together components and applications, or to automate interactions between systems | Used to build standalone applications or components that can then be glued together using scripting languag |
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.
Since scripting languages aren’t designed to write complete programs, they are slower and more energy intensive than programming languages. Most popular languages nowadays are actually considered scripting languages (like JavaScript or LUA). But wait, that doesn’t make sense, right?
For one, you can definitively write JavaScript code and compile it using the JS engine. And what about Python? It’s interpreted, but it’s considered by many people as a programming language. So what gives?
To be honest, the difference between scripting languages and programming languages has become rather muddy in the last couple of decades. Most modern and popular languages have enough behind them to do either task with relative ease. Having said that, no sane person would ever think about developing an OS or a video game engine in JavaScript.
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 development 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.