Here’s a simple example of some code:
print 'Hello, world!'
That line of code is written in the Python programming language. Put simply, a programming (or coding) language is a set of syntax rules that define how code should be written and formatted.
Thousands of different programming languages make it possible for us to create computer software, apps and websites. Instead of writing binary code, they let us write code that is (relatively) easy for us to write, read and understand. Each language comes with a special program that takes care of translating what we write into binary code.
Because different languages are designed to be used for different purposes – some are useful for web development, others useful for writing desktop software, others useful for solving scientific and numeric problems, and so on.
Programming languages can also be low-level or high-level.
Low-level languages are closer to the binary code a computer understands, while high-level languages bear a lot less resemblance to binary code. High-level languages are easier to program in, because they’re less detailed and designed to be easy for us to write.
Nearly all of the main programming languages in use today are high-level languages.
A program is simply a text file, written in a certain coding language. The code inside a program file is called the source code. Every coding language has its own file extension for identifying code files written in that language. For example, Python’s is ‘.py’.
To make a program, you write the code in a plain text editor like Notepad and save the file to your computer. That’s it. For example, the below line of code could be the contents of a very short Python program called hello.py:
print 'Hello, world!'
How do you run a program and actually get it to perform its commands? That varies between coding languages. Some languages save a separate binary file that the computer can directly run, while other languages have their programs run indirectly by certain software.
In the case of our hello.py file, the Python language comes with a command line which will display the output of the program – the text ‘Hello, world!’. If you were to enter the code into the command line and press enter, the program gets run and the command will get executed.
A computer doesn’t actually understand the phrase ‘Hello, world!’, and it doesn’t know how to display it on screen. It only understands on and off. So to actually run a command like print 'Hello, world!', it has to translate all the code in a program into a series of ons and offs that it can understand.
To do that, a number of things happen:
The coding language first has to translate its source code into assembly language, a super low-level language that uses words and numbers to represent binary patterns. Depending on the language, this may be done with an interpreter (where the program is translated line-by-line), or with a compiler (where the program is translated as a whole).
The coding language then sends off the assembly code to the computer’s assembler, which converts it into the machine language that the computer can understand and execute directly as binary code.
Isn’t it amazing to think that something as deceptively simple and primitive as binary code can create things as complex as what goes on inside a computer?
Your screen, operating system, photos, videos, the Internet, Facebook, your online bank account, and this website – all these things can be constructed from nothing but 1s and 0s. It’s a real symbol of human achievement.
Don’t worry if this process seems complicated and confusing – the whole reason that coding languages exist is to simplify it all for you!
There are thousands of coding languages in existence today.
Coding languages aren’t like our languages – there are no vocabularies or alphabets. They’re more like codes – special commands, abbreviations and ways of arranging text.
All software is written in some kind of coding language. And every coding language is unique, designed with a certain operating system, platform, coding style and intended use in mind.
Explore the next chapter to find out more about some of the main coding languages used every day.