Script languages vs. compiling languages

The biggest advantage of compiled languages is their execution speed. Since the programs are already available in the native machine code, there is no need for an intermediate step through an interpreter or similar. Compiled languages are also usually type-safe, i.e. the type of variables must always be declared.

Another advantage of compiled languages is the pointer arithmetic. This allows very experienced programmers to develop very efficient code, whose execution speed is mostly unmatched by interpreted languages, but is also generally more difficult to read by humans. Furthermore, memory management is mostly in the hands of the programmer, where (appropriately experienced) programmers can write memory efficient programs.

Compiled languages are also needed when, for example, a driver needs to be developed, a task that is difficult to solve in high-level programming languages and that causes a large loss of performance.

Compiled languages

The biggest disadvantage of compiled languages is on the one hand the pointer arithmetic (if the language offers it), and on the other hand the compiling of the programs itself. Furthermore the syntax of some languages is still very close to assembler (see C).

The problem with pointer arithmetic is that careless handling can lead to large security holes (especially obvious with null-terminated strings, as they are used e.g. in C) and on the other hand the direct handling of pointers can lead to errors in the program itself (keyword null pointer). And careless handling of memory management can often lead to memory leaks.

Compiled programs must (as the name says) be compiled before they are executed. This is done by a compiler that compiles the program. This takes more or less time depending on the length of the program, but even compiling short programs takes noticeably long ( > 2 sec ). In addition, especially with more complex programs, they still have to be linked, and any errors often result in somewhat cryptic error messages.

This circumstance is especially unpleasant if you make only small changes to a program and want to test them immediately. This so-called Write-Compile-Run cycle can lead to more or less big delays in the development of a program.

Scripting languages

Their syntax is often closely related to human languages (with the inglorious exception of Perl), which allows even inexperienced programmers to quickly read into programs. Furthermore, they often provide syntactic elements that low-level programming languages can usually only provide via libraries – best example are built-in hash arrays (or associative arrays).

Script languages are mostly typeless – which is an advantage (the programmer does not have to care about possible conversions) and a disadvantage (the type of a variable is not necessarily known).

This is also very much related to the philosophy behind a programming language – in Ruby especially Duck Typing, which focuses on the typelessness of a variable.

Scripting languages often offer built-in memory management (called garbage collection) and do not offer pointer arithmetic. RAD (Rapid Application Development) often relies on scripting languages as well, since the elimination of the compilation step means that changes can be tested easily.

The speed disadvantage of scripting languages becomes particularly obvious in computationally intensive tasks – here, there are various techniques that try to circumvent this disadvantage. These include runtime optimization, translating to bytecode, interpretation by a virtual machine, or writing critical routines in a low-level language (in Ruby, for example, this is possible via InlineC, which allows the programmer to mix Ruby with C code).

In addition, some languages “support” the syntax of some languages to create unreadable programs – Perl is cited once again as an example – but Ruby also tempts some people to syntax “over-sugar”.

The combination

Compiled scripts are then best. They invalidate the argument of speed. But in contrast to compiled programs, scripts are translated into machine language only shortly before usage. This allows a wide flexibility and programming errors can be filtered before the script is executed.