GoldBorder Title GoldBorder Title
Programming: Lesson 5, Talking Code
"How is this code talking to the computer?"

Like Magic, typing code into the box and clicking the button 'Check My Code' causes the computer to do something.

But, how is the code actually being understood by the computer? Computers speak a language called "Binary".

Human Languages of the world contain letters (aka symbols) like 'A', 'β;', and ''. The symbols for a language is called its 'alphabet'.

Computers have a very small alphabet with only two symbols, '0' and '1'. Computers like this since it is easy to understand '0' (off) or '1' (on). This comes from how computers keep track of information.

Like a light switch, you would turn it on for light, and off for no light. Inside computers are many (millions, billions, trillions) such light switches. It can turn each switch on/off as it needs. Within the computer are tables defining what number of lights on/off mean something else.

Let's pretend the computer had a table for letters 'A', 'B' and 'C'. The table could be like:

  • A = (3) lights on in a row
  • B = (1) light on, followed by one (1) light off, and finally one (1) light on
  • C = (1) light on, followed by two (2) lights off

    The pretend table could look like:

      A = 111
      B = 101
      C = 100

Now that you know what language the computer speaks, you can see how trying to communicate with them in their language would be very difficult. You would be flipping thousands of light switches just to say "Good Morning" to the computer.

Luckily, another language was created to help with speaking the 'Binary' computer language. This next level of language is called the 'Machine Codes'. Unfortunately, this language is so close to Binary that it only used numbers. An example phrase in the 'Machine Code' language looks like:
    29 8 55 51 39
The computer can understand the 'Machine Code' language as well and will convert it to the 'Binary' language. The 'Machine' phrase above would end up being the 'Binary' phrase below:
    00011101 00001000 00110111 00110011 00100111
    • 29 = 00011101
    • 8 = 00001000
    • 55 = 00110111
    • 51 = 00110011
    • 39 = 00100111
Though there are some 'hardcore' coders who actually do some work at the 'Machine Code' level (my hats off to you!), this still isn't friendly enough to easily program in.

Another level of language was created called the 'Assembly Language'. This language started getting closer to what humans can read, since it doesn't contain only numbers. Here are a couple lines of 'Assembly':

  • CMP A #'9
Pretty unfriendly looking, no? Programs called 'Assemblers' can take the 'Assembly' language above and convert it into the 'Machine Language', which is then translated by the computer into 'Binary'.

Hopefully, after seeing 'Binary', 'Machine' and now 'Assembly' you are saying "What? This is crazy talk!" If so, I'm with you!...As are most programmers.

We are now at the last level of languages. I like to call these 'programmer friendly' languages. One of these is the JavaScript language you have already used. There are hundreds of these 'friendly' languages available to programmers. All of them go through the same way of 'Talking Code' to the computer.

Now that you know about the different levels and how they get translated, you can now forget it! All you (and most programmers) have to learn is the level where JavaScript lives. The others...'Assembly', 'Machine' and 'Binary' can now be a distant memory.