W1082 Programming Language Survey

From Coder Merlin
Revision as of 22:06, 29 November 2021 by Tatsat-jha (talk | contribs) (Began changes to compiled and interpreted languages section almost finished compiled languages, more markup required, further changes to portability topic of compiled languages required)
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Overview[edit]

Programming Languages may differ in several aspects whether that be in the language's syntax, the language's execution of source code, the language's handling of semantics etc. The following will be an overview of these key aspects and their relation to both historical and modern programming languages.

Compiled and Interpreted[edit]

The first categorization of programming languages is the distinction between Compiled Languages and Interpreted Languages. This distinction has to do with the way a program is executed and, in a sense, translated.

Most languages are written using characters and numbers humans are familiar with; this is what's referred to as source code. However, words such"public," "static," and "void" can not be understood by a computer. This is why before a program can be executed it must be "translated" into machine code (also referred to as binary). The primary approaches of "translating" source code are Compiled and Interpreted

Compiled Languages[edit]

Compiled Languages take the approach of simply running the source code through a compiler which will result in a executable file (machine code). Essentially, the compiler translates the source code directly into machine code. As a result, Compiled Languages tend to run faster and perform more efficiently than Interpreted Languages.

However, this approach also means that Compiled Languages must be re-compiled following changes to the source code as those changes must be translated again. This can lead to slower production when working with a Compiled Language

Additionally, the resulting machine code that is produced by the compiler is machine specific. This essentially means a machine code file that had been compiled on a Windows machine will not be executable on a Linux or MacOS machine-an issue known as portability and why many consider Compiled Languages unportable

A common consequence of unportable languages are applications that can only be run on a single OS, affecting software ranging from video games to CAD software-essentially any environment where performance is critical and thus compiled languages are preferred

In summary, Compiled Languages are generally superior to Interpreted languages in terms of performance, but their primary drawbacks are that development time may be longer due to the nature of re-compiling and that the resulting machine code is platform dependent meaning portability becomes an issue.

Interpreted Languages[edit]

An interpreted language, as its name suggests, is a language that must be interpreted before it can be run. Interpreted languages generally require there to be an interpreter available on the system in order to be run, and are interpreted each time the program is run. Interpreted languages are also usually higher-level languages such as Python, JavaScript, and PHP.

The biggest advantages of an interpreted language is portability and speed of development. An interpreted program can run on any system with a compatible interpreter, which means that a Python script written on Linux will run properly on Windows, assuming that a Python interpreter is installed on both. Development can also be faster with interpreted languages because they don't need to be compiled in their entirety in order to test them. Additionally, interpreted languages require the developers to put less thought into memory management, and the language can do more of the work during execution (some higher-level compiled languages such as Swift and Rust can also handle most of the memory management, but do so in a different way).

The biggest disadvantage is slower performance when the program is being run. An interpreted language must be interpreted each time its run, unlike a compiled language which only needs to be compiled once. This can result in a longer wait for the program to start after executing it as well as lower performance throughout the duration of the program. This is one of the reasons that C and other low-level languages continue to be popular for video games and other situations in which high-performance is important.

Bytecode[edit]

There is a third option that's less heard of but equally viable; bytecode. A bytecode language requires compilation similar to a compiled language, but retains the portability of an interpreted language. The program needs to be compiled once, but instead of being translated to machine code, the program is compiled to bytecode. This bytecode can then be run on any system with the correct runtime available (e.g. the JVM in the case of Java). These languages can also offer the memory management features from an interpreted language, which can help speed up development.

References[edit]