It’s All Greek to Me: A Review of Code

Difficulty: Easy

What if I told you that you know how to code? It’s true, and the reason that I know this is that you are able to read these sentences right now. You may not be able to hack into a computer mainframe or tell a robot how to smile, but you can code none the less. What’s even more impressive is that it is impossible to understand or communicate without knowing how to code.

So what do I mean when I say “code?” I must not mean the ability to tell computers how to function, otherwise I would have already lied to you. I’m not lying, so allow me to clarify:

Code = a representation of information

It’s really that simple (and beautifully simple at that). With this definition, it is easy to see that the English language is a code. The letters, words, subjects, predicates, sentences, and paragraphs that compose the English language allow us to convey, or represent, information in a common way so that information can be disseminated between two or more parties. It is in this common ground that we see the purpose/importance of code. It is used as THE medium to communicate. Without it, our society would be stuck in a time well before the dark ages.

Continuing with this definition of code, we can realize that as humans, we use several different codes to convey similar information. Each of these codes has a different purpose and effect, but can communicate the same concept given the right context. Let’s take the simple idea of an apple as a thought exercise. As an English-speaking person (that may have a deaf and a blind family member), I can communicate the concept of an apple in several different ways:

Encoding: Image

Encoding: Text

Apple

Encoding: Sound

Encoding: Sign Language

Encoding: Braille

⠁⠏⠏⠇⠑

Each of these representations above is different, but all describe an apple. You may have noticed that I snuck a word that you may or may not already know.

Encoding = the attribution of a specific code to information

We can encode any type of information. This information can be anything, such as data, ideas, pictures, sounds, and actions. I can also encode anything with anything. For the sake of argument, let’s come up with a new encoding of the English alphabet.

A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z

I have attributed (encoded) random symbols to each letter of the alphabet, and in doing so, I can now freely communicate in this new code.

                        

This all seems simple enough, but what benefit does this have other than being able to pass tediously-written notes between friends in middle school? Well, the beauty of encoding really comes into play when we “randomly” assign meaning to electricity flowing through wires. You may have heard before that computers “only understand zeros and ones.” (This is otherwise known as “understanding Binary.”) This actually isn’t true, because computers don’t “understand” anything, rather, we as humans personify the idea of electricity flowing through specific circuits of a computer so that we can understand how they work. So what are zeros and ones? Simply put, they are an encoding that we attribute to the concept of whether or not electricity is flowing through a circuit.

Concept Encoding
Electricity not flowing through a circuit 0
Electricity flowing through a circuit 1

This encoding can then be capitalized to represent more and more complicated concepts. One of these more complicated concepts is that of the opcode, which is the encoding of a command on a set of concurrently on or off circuits. Opcodes are the basis of the most fundamental computer programming languages, and they can be combined in a specific pattern to ultimately create what we know as a computer program. As an example, let’s write a program for the dumbest “computer” of which I can think – the light-switch.

Opcode Command
0 Turn off the light
1 Turn on the light

If I wanted to make a program for my light-switch computer that flickers the light on and off four times, the program would simply be 10101010. When I input these opcodes (commands) in sequence to the light-switch computer, the computer will output a light that is on, then off, then on, then off, then on, then off, then on, then finally off. Yay, we’ve just written one of the most useless programs!

How about something slightly more interesting. Let’s create a program for our light-switch computer that communicates an S.O.S. distress signal in Morse code; S.O.S. in Morse code is “… _ _ _ …”. For our light-switch computer, the program would be 1010100011011011000101010. Excellent, we now have a slightly more useful program if we were to get stranded on a desert island with our flashlight computer!

For the sake of brevity, I won’t go into any more detail about the more complicated code and computer circuit paradigms that are used to build a computer; however, I would like to recommend future reading if you are interested in this topic.
One of the best books that I have found on bridging the gap between electricity and the inner workings of modern-day computers is called Code: The Hidden Language of Computer Hardware and Software by Charles Petzold. In this book, Petzold does a fantastic job at logically building a computer from ground up by starting at the fundamentals of code, logical circuit design, and data. The book also gives a great history of the origins of computers and coding languages, ultimately resulting in a book that creatively blends both narrative and technical specification to make the concepts understandable. It’s not the easiest read you will find, but it’s one of the easiest reads with material this complicated.

Keep coding!