Day 18

What is a Programming Language?

I get a little Computer Science 101 👩‍🏫 in this article. But, I promise you'll appreciate the background information.

 

This post is part of the series 30 Days of Web Development.

In this series, we start from the basics and walk through everything you need to know to get started with Web Development.

What is a Programming Language?

I get a little Computer Science 101 👩‍🏫 in this article. But, I promise you'll appreciate the background information.

Before we begin, I want to define what a Programming Language is. So far the only Programming Language we've introduced is JavaScript; HTML and CSS are both markup languages.

Put very simply, a Programming Language is a language that is used to write a set of instructions. These instructions are written to produce of output. A programmer is someone who writes these instructions.

You might be wondering, but aren't HTML and CSS just a set of instructions telling the browser how to build a web page? This is an easy point of confusion, while there might be some theoretical debate here, HTML and CSS are not considered Programming Languages.

It hasn't always been about computers 💻

When most developers think about Programming Languages, they assume that they are being used to write a set of instructions for a computer. But that was not always the case.

Believe it or not, the concept of Programming Languages pre-date the computer. Have you ever seen or heard an automatic piano 🎹, also known as a pianola? Pianola's are a piano that automatically take in notched scroll paper. These notches instruct the piano to press in its keys (see a longer video of one here).

Pianola's are not computers. But they use a Programming Language - in the form of notched paper - to operate the piano's keys accordingly.

I find it helpful to use the pianola example to clarify that this relationship is not reliant on computers. Programming languages are just formalized instructions, and a web developer, programmer, software engineer, etc. is someone who writes these instructions.

Different types of Programming Languages

There are hundreds of different kinds of programming languages. Thankfully, if you pursue a career in Web Development, you will only need to know a couple. And once you know one, the languages get much easier to learn.

But why are there so many Programming Languages? There's no short answer to this question, other than to say programmers wanted that many. Programming Languages are like tools, and depending on the job, you may want to use a specific tool. JavaScript is a popular tool for building websites, and Python is a tool often used for programs in financial trading. They could both do the other's job, but probably not as well.

Machine code?

Remember back to Day 3's Operating System blog article? In that article, I talked about how the Operating System translates your commands into 1s and 0s that the computer can understand.

Programming Languages are not a bunch of 1s and 0s, so at the onset, computers can't understand them. The same goes with browsers. The only reason browsers can understand JavaScript is because they come packaged with a special JavaScript rendering engine.

I find the topic of JavaScript rendering engines fascinating 🤓. Here's a great resource to learn more about this topic in detail.

Computers can only understand something called machine code. But what is machine code and why don't we write instructions using it?

To best answer that question, I'm going to show you a sentence written in standard text and then written in two types of Machine Code.

Studies have shown that goats have accents. Just like you and I, mate!

Below is that same goat-accent 🐐 sentence written in Machine Code, hexadecimal, base 16.

53 74 75 64 69 65 73 20 68 61 76 65 20 73 68 6f 77 6e 20 74 68 61 74 20 67 6f 61 74 73 20 68 61 76 65 20 61 63 63 65 6e 74 73 2e 20 20 4a 75 73 74 20 6c 69 6b 65 20 79 6f 75 20 61 6e 64 20 49 20 6d 61 74 65 21

Again, the same sentence, but written in Machine Code binary format, base 2.

01000010011001010010000001110011011101010111001001100101001000000111010001101111001000000110010001110010011010010110111001101011001000000111100101101111011101010111001000100000010011110111011001100001011011000111010001101001011011100110010100101110

Machine code is either written in hexadecimal or binary. A computer can read both. If you're like most everyone, reading and writing binary and hexadecimal is not something you can easily do. The only thing capable of quickly reading through machine code is your computer's central processing unit (CPU). Your computer likes machine code because the short syntax makes it easy for your CPU to execute it extremely fast.

Low to High-level Programming Languages

Programming Languages can be organized along an axis of those that are more similar to machine code, or less similar. Programming Languages that are more similar to machine code are called low-level languages. The farther away a Programming Language is to machine code, the more high-level it is.

The lower-level the language, the more specific it is to the computer's hardware. For example, the language just above machine code is called Assembly language. It is written specifically for the computer it is on. Which means that if you write it for your computer, it's likely someone else's computer can't read it. The computer science term for this is called portability. The Assembly language has very low portability because it cannot be "ported" or used by other computers than the one it was written for.

 

This page is a preview of Your First 30 Days of Web Development

Get the rest of this chapter and 180+ pages of Web Development instruction for free.

The entire source code for this tutorial series can be found in the GitHub repo, which includes all the styles and code samples.

If at any point you feel stuck, have further questions, feel free to reach out to us by: