FROM lifts to cars to airliners to smartphones, modern civilisation is powered by software, the digital instructions that allow computers, and the devices they control, to perform calculations and respond to their surroundings. How did that software get there? Someone had to write it. But code, the sequences of symbols painstakingly created by programmers, is not quite the same as software, the sequences of instructions that computers execute. So what exactly is it?
Coding, or programming, is a way of writing instructions for computers that bridges the gap between how humans like to express themselves and how computers actually work. Programming languages, of which there are hundreds, cannot generally be executed by computers directly. Instead, programs written in a particular “high level” language such as C++, Python or Java are translated by a special piece of software (a compiler or an interpreter) into low-level instructions which a computer can actually run. In some cases programmers write software in low-level instructions directly, but this is fiddly. It is usually much easier to use a high-level programming language, because such languages make it easier to express complex, abstract ideas or commands efficiently and accurately; they also absolve programmers from having to worry about tedious details relating to the innards of the particular computer on which the program will eventually run. A program written in a high-level language can therefore be made to run on all sorts of different computers.
Programming languages exist in many families and styles, rather like human languages. There are many dialects of C, for example; there are families of “functional” programming languages; and there are languages optimised for “parallel processing” (where several programs run alongside each other to accomplish a particular task, such as image processing or weather forecasting). As with human languages, these programming languages are all capable of expressing the same ideas, and in theory any program can be written in any language. But in practice some languages are better suited to some uses than others, just as French is traditionally used for diplomacy and English is the international language of business. And just as knowing a few different spoken languages makes it easier to learn another one, the same is true of programming languages. Once you understand common features (loops, recursion, conditionals, regular expressions and so on) you can usually pick up a new language quickly, particularly if it’s reasonably close to another language you already know.
Writing a program and then running it is magic, in a way. The numbers, letters and symbols of code are transmuted into instructions executed by microscopic circuits to achieve the desired results. Pixels appear on the screen; lifts move; airline tickets are ordered; lists are sorted; e-mails are delivered. But just because the results seem magical does not mean that coding is mysterious and inaccessible. Indeed, one of the joys of coding is that computers are the opposite of mysterious: they operate in an unforgivingly predictable, consistent and deterministic manner. Most people do not need to be able to write code to do their jobs, any more than they need to be able to speak foreign languages or do algebra. But it is useful to have some basic experience in coding, and not just to demystify how computers work. As Marc Andreessen, the co-creator of the Netscape web browser, likes to say, in future there will be two kinds of jobs: those that involve telling computers what to do, and those that involve being told what to do by computers. Worried that your job is in danger of being automated away by software? Learning to code could be a useful insurance policy. Even if you’re not, it can also be fun.
Powered by Facebook Comments