As a programmer of any type, you know the code you write isn’t directly acted on in the form you write it by the computer your program runs on. There are several different methods to take your lines of code and turn them into something the computer can run (machine code). One of those methods involves a kind of programming language called an interpreted language.
With an interpreted language, the program runs directly from the actual source code. One common advantage of an interpreted language is its platform independence. The source code you write and distribute is platform independent; the interpreter that executes the program will handle any platform-specific issues.
There are varying degrees of adherence to pure interpreted language concepts. Shell scripts and batch files stick close to the complete pure definition of interpretation by just executing one line of code at a time. Other interpreted languages do some preprocessing and optimization of the raw code before interpreting them to speed up overall execution.
In a variation on interpreted languages, some languages use an intermediate step. Java is one of the best-known examples of this type of language. In this case, the Java compiler outputs bytecode (which is still supposed to be platform independent) that then is run by a bytecode interpreter (known as the Java Virtual Machine (JVM)) on each platform. Other languages using this method are Python and Perl. Microsoft’s Common Language Runtime (CLR) is the functional equivalent of Java’s JVM in the .NET versions of Microsoft’s languages. The CLR interprets the Microsoft Intermediate Language (MSIL) code the compiler creates when you compile VB.NET, C#, and the other .NET languages.
A disadvantage of interpreted languages is that the computer you will be running the program on needs to have not only the program on it to be run, but it also has to have the language interpreter. Anyone who has ever used Windows in the 90s probably had an experience trying to run a VB program on a computer that was missing the VBrun interpreter or had the wrong version of the VBrun interpreter. With the popularity of Java and the wars between Java implementations particularly on Windows, the Java bytecode interpreter has become another frequent headache for users and programmers alike.
Another disadvantage of interpreted languages is execution speed. When a language is compiled, all of the code is analyzed and processed efficiently, before the programmer distributes the application. With an interpreted language, the computer running the program has to analyze and interpret the code (through the interpreter) before it can be executed, resulting in slower processing performance.
In a future article, I’ll look more at the alternative to interpreted languages, compiled languages.
About the Author
Jim Minatel is a freelance writer for Developer.com in addition to working with Wiley and WROX publishing. He maintains a blog at http://wroxblog.typepad.com.