As a scripting service provider, a question we are often asked is: what are the differences between a script, and a piece of code at large?

Formal definition

In theory, a script is a piece of code, but it has some particularities in its execution method. In order to understand the difference between the two, it is necessary to analyze how the code can be executed by your machine.

A code can be compiled, which means that its content is translated by a program, called a compiler, in order to turn it into binary code understandable by your machine.

However, not all code is compiled. Some code is interpreted. This means that your code will have to be read by another program, called an “interpreter”, which will execute it on your machine.

This last category of languages is also called scripting languages, where each program is also called a script.

Some examples

To better understand the difference between these two types of languages, let’s take an example. The C++ language, needs to be translated into a binary file (.exe) under Windows, while the Python language needs to have the Python interpreter installed beforehand, which will allow you to execute .py files

Among the most popular scripting languages in 2022, we can quote for example:

  • Python
  • Ruby
  • JavaScript
  • Bash

What does this imply?

Theoretically, there is little difference between compiled and interpreted languages. There are even so-called “hybrid” languages, which are compiled on the fly, in order to work more efficiently.

However, the advantage of a scripting language is that it allows you to quickly execute small pieces of code without having to do a full translation. These languages usually provide you with tools to facilitate this, such as an interactive shell, or REPL, which is an interface that allows you to write code on the fly for quick testing.

These scripting languages are therefore particularly useful for the rapid automation of repetitive tasks, by writing small pieces of ad-hoc code, useful for spontaneous use. They can be used for many purposes such as extraction, data transformation, calculation, …

About us

At Jotcode, we offer an easy to use hosting platform to store and run your scripts online, without having to install anything on your machine, or on a server.

Want to know more, discover us on