Skip main navigation

What is coding?

This article describes what coding is, and offers a video to find out about how programming languages work.
(futuristic music) Every time we use a computer, we are issuing instructions to it in different ways. When we use a keyboard, we are telling it which letters to type. When we click on a document, we are telling it to open that document. When we click mute, we are telling it to turn off the volume. But how does the computer know what actions to take when we do these things? This is where programming and code comes in. The programs within our computer tell it what to do when a certain action occurs. A program is a set of instructions that tells a computer what to do to come up with a solution to a particular problem.
The instructions or programs are written in a programming language that uses code to tell the computer what to do. There are different languages known as programming languages that can be used to give these instructions to the computer. Since people and computers communicate differently, unless you speak binary, these instructions need to be translated between computers and people, and written in a way that can be translated. Some programming languages are closer to computer-speak than others and are known as low-level languages. Because they are closer to computer-speak, low-level languages require a deep understanding of computer hardware and functionality. There are two types of low-level language. Machine code, which is binary code of ones and zeros.
Machine code requires no translation since this is the language the computer speaks in. And assembly language, which is a mix of symbols and letters. Assembly language, while still closely tied to the language of the computer, does need some translation. This is done using an assembler. Although not as difficult for people to learn as binary, assembly language is still quite difficult. To help make programming more accessible, high-level languages were developed to bridge the gap between human language and computer-speak. Like the written languages we are familiar with, high-level programming languages have a standard set of rules so that the instructions don’t get lost in translation. Similar to grammar and sentence structure, these languages have their own specific syntax.
Syntax is the set of rules that govern how the code within the instructions must be structured. For example, there are often different requirements for identifying texts and numbers so that the computer can identify the difference and process these correctly. Statements are used to communicate an instruction to the computer so it performs a specific action. These have rules as well. For example, they usually begin with a command. Consider when you double-click a document. Your double-click issues a command to open the file. Clicking the cross in the top corner of your word processing application issues a command to close the document. The syntax of a high-level language is much closer to English than the ones and zeros a computer can understand.
We write code in a high-level language, such as Python, C++, or Java. Our code still needs to be translated for the computer to understand it. Similar to how assembly languages need an assembler to translate it into machine code, high-level languages are translated using either an interpreter or a compiler. Compilers are computer programs that translate programs written in a high-level language into the language of the computer. Compilers take the source code and compile it into machine code. This translation is done before the program can be executed, but once it’s compiled, the output can be run over and over again. Think of it this way. You’re watching a movie with subtitles.
The entire movie would be translated and then the subtitles are compiled and added to the movie. On the other hand, interpreters translate the code for the computer as the program is run rather than compiling it beforehand. This translation occurs each time the program is run. This wouldn’t be ideal for subtitling a movie, but it would be ideal if there was someone speaking and you needed to translate it in real time for the audience.

Known as the language of computers, coding is often described as ‘telling your computer what to do’, but it’s not quite so simple.

What is coding?

Think about writing code like this. The language computers speak in binary code – a mathematical language of ones and zeros. You don’t speak binary, and the machine can’t come close to understanding human languages, so you need to design a translator that can act as an intermediary.

Code is a form of writing that is easy to learn and interpret for humans, and even though it isn’t binary, the computer can still understand it.

Translating commands into a computer

Imagine you are building an elevator shaft with a group of engineers. You’re on the bottom of the shaft, they are at the top, and you need to communicate to finish the project.

All you have to communicate with the engineers is a flashlight. One flash for yes, two for no. It will take a while but, eventually, the elevator shaft will be built. The true purpose of code is to translate your commands into the language that the computer understands.

Try this exercise

With your mouse, right-click on any blank portion of this page and choose View Source. A new window displaying characters and words will appear.

Don’t worry if this looks pretty technical and foreign – these characters and words are the HTML programming code, and each element within that code is known as an HTML tag. This enables you to look ‘behind the scenes’ of almost any page on the internet.

When you code, typically the languages are still tied to human constructs of language, but the code is usually picked up and read by programs within the computer, adding another layer of translation into the mix.

Watch the video below to find out about how programming languages work.

This article is from the free online

Software Development Fundamentals: Programming Languages and HTML

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now