When someone first starts programming, the whole concept of “interpreted” languages and “compiled” languages might seem a bit confusing. Luckily, it’s really not. Here’s how they break down:
All decent programming languages are either compiled or interpreted. What language you’re programming in determines whether you need to download an interpreter or a compiler to run the programs you create.
There are a few differences between the two types of languages.
A “compiled” program is just that: compiled. Everything that has to do with the program, including the source code, required files, references, and anything else, are all rolled up into one “standalone” executable that can run on any similar system without needing to install anything else. Any program that you download from the internet and are able to “just run” is a standalone executable that has been compiled.
With an interpreted language, you need a second program to run the program—an interpreter. You feed the source code to the interpreter as it runs and it creates the program on the fly. Because of this, interpreted languages are traditionally slower than compiled languages, but not usually enough to notice for general programming. If you’re relying on calculation-heavy processing where execution speed is important, however, you’ll probably want to go with a faster, compiled language.
C and C++ are common compiled languages. When you compile a C++ program, for example, you receive an executable, or binary file, that you can run on any system that shares an operating system with the one that compiled the program. For example, if you compiled the program on Windows 7, you’ll generally be able to run it on any other Windows 7, Windows Vista, or Windows XP computer. If you want to run it on another operating system such as a Mac, you’ll have to compile the source code on a Mac to get a Mac binary file.
Conversely, interpreted languages such as Perl and PHP may require an interpreter installed, but the same source code can be fed into an interpreter on any operating system without modifications in most cases. This allows you to write a program on Windows, for example, and quickly distribute it to other Windows users, Mac users, Linux users, even people who installed BSD on their roommate’s microwave.
Occasionally you’ll stumble upon a weird language that makes up its own rules, such as Java. They allow you to “compile” your program, but people who want to run it still need to install what amounts to be a Java interpreter—the Java Virtual Machine (JVM). Each language has its quirks, and while some fall somewhere between the two ends of the spectrum, they all have more information online about how they work if you’re interested.
In conclusion, programming languages can generally be split into two types: interpreted and compiled. If you’re looking to hide your source code, distribute to computers that don’t need to install an interpreter, or need a faster executable, you probably want a compiled language. If you’re looking to whip up quick scripts that can be run on any operating system (installing an interpreter is a one-time thing, and most non-Windows systems come with several interpreters already installed!), want to ensure that your programs are safe, or are just looking for a traditionally easier language to program in, you might be interested in an interpreted language.