Mark As Completed Discussion

Compiled vs Interpreted

Before you write an application your first job is to choose a language. There are many languages you can choose from, but almost all share one thing in common; your computer can't understand them.

The reason I said "almost all" is because there is one language computers can read; machine code.

Machine code is a computer programming language consisting of binary or hexadecimal instructions which a computer can respond to directly.

Although it's possible for developers to program in machine code, most don't and instead opt for a high-level language.

The differences between low-level languages and high-level languages could be its own article, but the basic summary is:

  • A low-level language is written for one type of architecture (Windows, Linux etc) and won't work on another. It is more difficult to read and understand but has a higher level of performance.
  • A high-level language is basically the opposite. You can write it once and it will run on all, or at least most, architectures. It's a lot easier for people to read and understand but isn't as performant.

Which languages are high-level, and which are low-level? Every language sits on a spectrum.

Those that are less complex for humans to understand and write, but provide less flexibility over what the programmer can do, are considered high-level. A language at the top of this spectrum could look like this (note: a language this high-level has not yet been created):

Create an application that accepts two numbers,
subtract the second from the first,
return the result.

Those that are more complex for humans to understand and write, but provide much more flexibility over what the programmer can do, are considered low-level. The language at the bottom of this spectrum is machine code, which looks like this:

0x 60 00 00 80
0x A4 00 00 00
0x 60 01 00 84
0x A4 01 01 00
0x 60 02 00 00
0x 60 03 00 04
0x 60 04 00 00
0x 60 05 00 01
0x 08 00 00 02
0x 20 00 00 03
0x 20 04 04 05
0x 11 20 04 01

Somehow the code we write has to be translated into the language that computers can understand (machine code). This is either done using compilation or interpretation.