Friday, October 8, 2010

Project 8 - Source Code Verses Executable Code

Many people have some idea of what source code and executable code are, however, most only know the laymen terms for it. The differences between these types are not particularly well defined.

In laymen's terms, source code is what is written by the programmer, which is human-readable, cannot immediately be executed by the machine, and usually has meaningful variable names and comments intended only for humans. Executable code, (or object code) is not human readable, must be compiled by a compiler, and is a sequence of bytes that give specific instruction to the computer.

When you delve deeper, however, you find that executable code is readable by humans, it's just more difficult than high level languages such as Java or C, and that to be executed a program doesn't necessarily need to be compiled. An interpreter can be used  instead to communicate to the machine the source code as it is.

When two people who speak different languages want to talk to each other, they need a third person, called an interpreter to speak in between them who knows both languages. Let's say persons A and B speak languages T and U respectively only, and person C speaks both T and U. As person A gives instructions to person B, person C relays them as they are spoken. This is like what an interpreter for computers does. In this example person A would be the programmer, person B would be the machine, person C would be the code interpreter, language T would be the source code and language U would be the executable code. A compiler on the other hand, would be more like person A writes a letter to person B in language T and gives it to person C. Person C than, takes that letter (source) and translates it into language U and makes sure everything is correct before than handing the now translated (compiled) letter to person B. Person B than follows the instructions (executes) laid out in the letter.

In this example, person A is the programmer, person B is the computer and person C is the compiler or interpreter. So what does assembly language have to do with anything? Well assembly language is as close as you can get to binary language without actually using binary. It's very short commands (usually 3-5 letters long each) which directly translate into the machine language. Because of this it's very specific to each machine, like different dialects between tribes. While the languages are very similar, it must be spoken slightly differently depending on whom (which processor architecture) you're speaking to. Assembly language reduces the translation needed for the programmer to talk to the computer. So, person A would be able to say his bit, and person C would be able to take it to person B with little changes, sayings that exist in language T would translate effectively over to language U (If I said "he's pulling you across the table" you would look at me weird, but if I told a German-speaker this it would come across the same as "he's got you wrapped around his little finger" would to you).

No comments:

Post a Comment