Basic Programming Principles

Reading a Script Versus Filming a Movie: Interpreters and Compilers

Python is the language we will be using in this tutorial series. One thing to understand about Python is that it is an “interpreted” language. An intepreted language is one which is executed on-the-fly by a pre-existing program which must be installed on the program which executes the language. In this way, you can think of your Python programs as “scripts.” They are not written in machine language for execution, but rather the pre-existing program will translate the code you write into machine language and execute it in a contained environment.

This can be a minor inconvenience in some cases, such as when you have written a program in Python and want to distribute it. You must make sure that everyone who runs your program has the Python interpreter installed.

This is like reading a movie script, on-the-fly. An actor in a film will read the script, and execute both the dialog and performance that the script calls for. In this case, the actor is acting as an interpreter. He reads the script, and while he is reading the script he executes its commands. The script he is reading is written in plain language so he can understand it.

The alternative to an interpreted language is a compiled language. In this case, a process on your machine as developer will take your program and convert it into a machine code executable file (“exe file” on Windows) such that the computers which run your program can execute them directly. In this case, the people who want to run your program can execute it without an interpreter installed. This simplifies the deployment process for installing programs.

Keeping with our movie analogy, this would be like recording the actor as he reads through the script. You are taking the results of his reading the script, and recording it to film. To run the program, all you need to do is replay the film. The film is stored in some kind of digital or chemical format which can be played back. You don’t need the actor to re-read the script and act again every time you want to watch the film.

Since Python is an interpreted language, you must make sure that you have the Python interpreter installed on your machine. If you plan on giving out, selling, or running your programs on other computers then you will need to make sure they have the Python interpreter installed as well.

Pages: 1 2 3 4 5