What Is Source?

 < Day Day Up > 



In order to understand what source is, you should understand a bit about how a program actually gets from its primitive state on the programmer’s computer to an up-and-running application on your machine. First the programmer writes a program in a programming language. You have probably heard of programming languages such as Basic or C, and there are many others. What the programmer actually writes with such a language is a set of instructions called the source code, or source. Your computer, however, cannot actually understand any of that source on its own. It is as if the computer speaks ancient Greek, and the source code is all written in French. The computer therefore needs some sort of interpreter to help it out.

The various languages that programmers use are called high-level languages — they are relatively easy for programmers to read. The computer, on the other hand, only understands what are called low-level languages, which are quite difficult for most mere mortal programmers to deal with. To convert the high-level language instructions to a low-level language, the computer needs some other program to translate.

This can be done while a program is running, in which case the translator program is called an interpreter. Applications that run using an interpreter are usually called scripts. The pyWings application in Chapter 9 is an example of such a script application.

The problem with such script applications is that they can be slower, because the computer must run an interpreter, interpret the source code, and run the actual application all at the same time. This is like having a French book translated to a Greek speaker by a live interpreter — very slow indeed.

As an alternative, many programs use a compiler instead of an interpreter. A compiler translates the high-level source code into low-level machine code, or object code, that the computer can understand before the application is actually run. Once this translation is done, the computer never has to bother with the high- level instructions again; it can merely read the translated version each and every time it runs the program. This is like reading a translated version of a foreign book that you can read any time you want to without assistance. Because computers can run compiled programs without simultaneously using an interpreter, compiled programs run faster. Most applications for all operating systems are, therefore, compiled.



 < Day Day Up > 



Linux for Non-Geeks. A Hands-On, Project-Based, Take-It-Slow Guidebook
Linux for Non-Geeks: A Hands-On, Project-Based, Take-It-Slow Guidebook
ISBN: 1593270348
EAN: 2147483647
Year: 2003
Pages: 188

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net