"Lying in a featherbed will bring you no fame, nor staying beneath the quilt, and he who uses up his life without achieving fame leaves no more vestige of himself on Earth than smoke in the air or foam upon the water." -Dante Alighieri
In this guide, I will try to explain the difference between compiled and interpreted languages and offer some pros/cons of each.
--Definitions--
Compiled Language: A compiled language is a programming language that uses a compiler to process your source code into machine code to be used on a particular type of processor (for example, programs compiled on a x86 Intel/AMD processor will not usually work on a PowerPC processor like those found in older Macs). Compilers are usually able to optimize compiled code significantly, resulting in speedy code.
Examples of compiled code include C/C++, Delphi/Pascal and Assembly.
Interpreted Language: An interpreted language, on the other hand, is executed by a program called the interpreter. With the interpreter, a source file can be directly executed, without having to be compiled first. The interpreter reads the source file and figures out what machine instructions to execute, so that it essentially translates your source code into machine code on-the-fly without compilation.
Examples include: Python, Perl, PHP, Java and Shell Scripting.
Compiled languages typically give the programmer a much higher degree of control over the allocation of memory and the nitty-gritty of memory access. Interpreted languages usually have memory allocation handled mostly or entirely by the interpreter.
This difference also explains why compiled languages are usually considered "low" to "medium" level languages, while interpreted languages are "high-level" languages. High level languages are "farther away" from the system, while low to medium languages operate closer to the system.
Pros of interpreted languages:
- Rapid prototyping - programmers spend less time working with low-level ideas and more time building algorithms
- Simplicity - it is usually easier to understand high-level code due to it's inherent ability to "hide" complicated low-level workings
- Ready access to hundreds of prebuilt libraries of code, for things like graphics manipulation
- Simple to implement certain tasks, such as string or array manipulation, which require far more work to do in compiled languages
Cons of interpreted languages:
- Slow, possibly high memory usage
- Some interpreted languages execute only source code; compiled languages can be distributed with only the binary and not the source
- Interpreted languages depend on an interpreter to be present, which may be difficult to fulfill for the end-user
This is by far not a complete list, but it should give you an idea of why you should know one of each type of language.
If you only knew a compiled language, you might find it difficult to complete many of the Permanent Programming challenges because many require a good algorithm, and implementing algorithms is easiest in an interpreted language due to rapid prototyping, while using a compiled language may take a lot of time.
If you didn't know a compiled language, it would be hard to make super-fast and efficient programs - many end users would prefer fast and lean programs over a program which is slow and requires an interpreter.
So, there are benefits to knowing both. Knowledge is power, as they say!
Cast your vote on this article 10 - Highest, 1 - Lowest
Comments: Published: 14 comments.
HackThisSite is the collective work of the HackThisSite staff, licensed under a CC BY-NC license.
We ask that you inform us upon sharing or distributing.