To understand what makes a scripting language, it helps to become familiar with conventional programming languages like C, C++, and Java. In these languages, the programmer writes a source text which is converted to binary code in another step. Two files are used in the process: the source text file that the programmer works in and a subsequent binary file that can be run directly on the computer. A compiler is a special program that acts as a translator between the two files.
The process of converting source text to binary code is called “compilation”. During compilation, the source text is checked for its plausibility: Are all the variables actually defined? Do the types of functional parameters match the functional definitions? Did the programmer forget a character somewhere? This check is performed across the whole source text and can take some time. The binary code generated from the compilation is strongly optimized so that it runs as fast and error-free as possible. Compiled languages are, therefore, particularly suited to computationally intensive tasks and larger systems.
No compilation is required when executing a program written in a scripting language. So, no binary file is generated from the source text written by the programmer. As a result, programs written in scripting languages are usually less efficient. However, this loss of efficiency isn’t merely a disadvantage. It’s a well-considered trade-off: scripting languages relieve theprogrammer by transferring more of the burden to the processer. For this reason, scripting languages are very useful for small to medium-sized programs.
The core idea of reducing the workload for the programmer can be seen as a running theme throughout the architecture of many scripting languages. For example, they dispense with the need for manual storage management – a particularly efficient, yet error-prone technique. Moreover, in most scripting languages it’s not necessary to enter the type of variable. Since programs written in scripting languages aren’t compiled, there’s also no need for a main() function. Software can be written directly using scripting languages, with less source text. Compare the following examples. Both programs deliver the same results: