Published
11 months agoon
By
Joe Pee
The very first programs were not written, they were literally assembled. The computer was a bank of physical logic gates. You would connect the inputs and the outputs together with wires to get the program you wanted. For convenience, this was often done with a network of plugs, which makes wiring easier to adjust quickly.
This kind of programming turned out to be very tedious. It took days to set up the program, and you couldn’t save a program to run it again later; every program had to be manually plugged in every time you wanted to run it. These are pictures of the ENIAC; one of its major applications was generating the ballistics tables used by artillery teams in World War II.
Unsurprisingly, the person who invented modern programming was someone who had to spend many hours of his life wiring up those stupid plug boards: John von Neumann.
His big idea was that you could use the same memory banks in which numbers were kept to store instructions for the computer to execute. You’d assign different numbers to every possible instruction that the CPU supported. 1 could mean add, 2 could mean load-from-memory, 3 could mean jump-if-not-zero, that kind of thing.
All the instructions are necessarily pretty simple, since the circuits for executing them have to be physically wired into the CPU. The computer would run a kind of clock; at every tick, it would load the next instruction from memory and execute it.
The first programming languages were written directly using these numeric codes, which are called machine language. At first, the languages were just the exact same instructions, but using words instead of numbers to make them easier to read: you might write “ADD” instead of “1.” This type of language is called Assembler, and was the first programming language. There are as many flavors of Assembler as there are types of CPUs.
The next generation of languages were written in Assembler, and so on up from there. In the end, everything ends up translated to machine code, though, since that’s what the CPU is actually running.