How do people write code? It starts with a simple idea, and it is a good one to look at first. A computer program is a list of instructions for a computer, and because a computer can't think for itself, people have to give it those instructions, and people called programmers write the code that makes computer programs. You may have heard that computers work out what you mean. In fact, a computer only does what the instructions it is given tell it to do. Think of a recipe. A recipe is an algorithm for people, which is a list of steps to follow, and the steps in a list of instructions have to be in the right order.
Here is a closer look at the word algorithm. An algorithm is a precise, ordered set of instructions, and the instructions have to be clear. It is a systematic procedure that produces the answer to a problem in a finite number of steps, and Euclid's Elements, published about 300 BCE, contained one for finding the greatest common divisor of two numbers. An algorithm describes a way to solve a problem so that it can be solved over and over, by people or by machines. a recipe is an algorithm for people, which is a list of steps to follow.
Underneath it all, here is how a computer works: computers run on binary code, where each digit is either off or on, written 0 or 1. Each decimal digit from 0 to 9 can be shown with four binary digits, called bits. Machine language is made of the numeric codes a computer can run directly. It is also called binary code or machine code.
A programming language lets people write detailed instructions for a computer, and machine and assembly languages are low-level, while high-level languages are easier for people to read and write. Code written in a language people can read has to be translated before the computer can run it, and a compiler does that job: it translates a whole program written in a higher-level language such as C++, Rust or Java into binary or machine code that can run. In coding, then, the computer does not read the same English words that people write.
Grace Hopper was an American mathematician and a rear admiral in the U.S. Navy. She was born on December 9, 1906, and she helped develop computer technology, including UNIVAC I, the first commercial electronic computer. In 1946 she wrote the first computer manual, which described how to operate the Mark I calculator at Harvard and was the first extensive treatment of how to program a computer. In 1949 she joined the Eckert-Mauchly Computer Corp. There she designed one of the first compilers and coined the word compiler. In 1957 her division developed Flow-Matic, the first English-language data-processing compiler. She retired from the Navy in 1986 at the age of 79, the oldest officer on active U.S. naval duty at that time. She was awarded the Presidential Medal of Freedom after her death, in 2016.
Two early languages followed. FORTRAN was created in 1957 by John Backus. Before it, programs were written in machine or assembly language, in binary or hexadecimal arithmetic, and FORTRAN shortened that process. It took three years to develop, led by Backus with a team of 10 IBM employees. It combined a form of English shorthand with algebraic equations. Its control structures included conditional IF statements and repeating loops, called DO loops. FORTRAN became the most often used language for scientific and technical computing over the following decades. The Computer History Museum says it is still in use, as of November 2026. COBOL grew out of the 1959 Conference on Data Systems Languages. It was designed to be portable, running with little change on computers from different makers, and easy to read like ordinary English. Its popularity declined beginning in the 1990s, but many large organizations, such as banks and government agencies, still used it in the early 21st century.
Every program stores and organizes information. A variable is like a box that holds a value, and the value inside can change. Variables are not the values themselves. They are containers for values, and they can hold nearly anything, even whole functions. Every variable gets its own name, so the program can find what is stored in it. A program can use a variable to keep track of something that changes, like a score or a count of clicks. A list holds many items under one name. A data structure is a particular way of organizing data so that it can be used efficiently.
Programs also decide and repeat. A program can make a choice with commands like IF, THEN and ELSE. In other words, a conditional runs one set of code if a test is true and another if it is not, like taking an umbrella only if it is raining. A loop makes a computer repeat a set of instructions. A loop can repeat a set number of times, or repeat until something happens. A function is a named piece of code that can be run, or called, whenever it is needed.
Python is a high-level, general-purpose programming language that was developed by Guido van Rossum in 1991, named after the British television series Monty Python's Flying Circus, and publicly released in 1994. You may have heard that it is named after a snake. In fact, it is named after that television series. It is open source, so anyone can use it for free.
As of November 2026, Scratch is a coding tool where kids make their own stories, games and animations. It was developed at the MIT Media Lab and released to the public in 2007. It is built on blocks that kids drag and snap together, so there is no tricky syntax to type, and that is how the Scratch Foundation describes it as of November 2026. In 2019 Scratch was transferred from MIT to the Scratch Foundation, an independent nonprofit that develops and maintains the Scratch platform and community. Syntax, by the way, is the set of rules for how code must be written.
Mistakes are part of the work. A mistake in a computer program is called a bug. Bugs come in two main kinds: syntax errors, which are mistakes in writing the code, and logic errors, where the instructions are wrong or in the wrong order. Programmers test a program to look for bugs, and debugging involves testing the outcome of programs and looking for any errors or mistakes, either in the original algorithm or in the final program code. Programmers can find a bug by checking a program one small step at a time, and a source-level debugger lets programmers look at variables, set breakpoints and step through the code a line at a time. It is okay to make mistakes in a program, because finding and fixing bugs is a good way to learn.
Behind all of this is a way of thinking. Computational thinking is the thought process of formulating problems and their solutions so that an information-processing agent, such as a computer, can carry them out. To be carried out by a computer, a solution must be a step-by-step process, an algorithm. Decomposition means breaking a big problem into smaller parts so it is easier to tackle.
Words to know
- algorithm: step-by-step procedure
- compiler: code translator
- variable: value container
- debugging: fixing bugs
- syntax: writing rules