Thank you for visiting Blazing Games

What is Compiling

Those of you who are new to the world of programming may not understand what I am talking about when I use words like compiling and interpreting. This sidebar will hopefully help you better understand what is going on.

When you write a program, you are using some type of text editor to enter the program. A program, after all, is just a series of commands written in a language that the computer can understand. Actually, that is not quite true. The truth is that a computer can only understand it's own language, which we call Machine Language. Different processors understand different machine languages.

To get a computer to understand the program that was typed in, there are two basic routes that are generally taken. The first is to have a program that analyses the text on the fly and converts that text into instructions that the computer can understand. This is called interpretation.

The other method takes the whole program at once and converts it into machine language. This process is called compiling. This would mean that only computers using the same processor type and operating system as the machine the program was compiled for would run the program. Yet Java class files will run on any machine! This is because Java source files get compiled into a virtual machine language which then gets ran through a Java Runtime Environment.

By using a virtual machine language, the code in the class file is in a very simple state from which it is easier to convert into the native machines assembly language. There are many ways to do this conversion, with the following three being most common.

First method, which is not used much any more, is to interpret the class file. This goes through the class file as it is used and converts it into native instructions as they are needed.

The second method is Just In Time compiling. This method quickly compiles the class files as they are about to be executed, meaning that once a method has been compiled, any additional calls to that method will be native calls.

The third method is the HotSpot technology that Sun is using. What this method does is interprets the class file while in the background looking at what parts of the program are executed the most. Those parts get compiled to produce the most efficient code possible.

Previous Chapter 2 Contents Page 3 of 7 Book Contents Next

About - Privacy Policy - Contact - Links - FAQ
Copyright © 2004-2006 Blazing Games Inc. All Rights Reserved