The craft of creating software involves programming languages, the means by which humans communicate with machines, telling the machine what to do. But can programming languages really be considered in the same vein as natural languages? Both have two items in common: semantics, and syntax. Semantics convey the intention of a language, while following a set of rules – the syntax. But that’s really where the similarities end.
Human languages help tell a story. The story can be a piece of nonfiction, a folktale, or some form of tragedy. Programming languages do not convey a story, but rather a set of instructions, akin more to a recipe. Imagine if “The Three Little Pigs” were told from an algorithmic viewpoint:
- The three little pigs leave home.
- The first pig builds a house of straw.
- The wolf blows down house of straw, and eats the pig.
- The second pig builds a house of sticks.
- The wolf blows down house of sticks, and eats the pig.
- The third pig builds a house of bricks.
- The wolf doesn’t blow down the house, and comes down the chimney instead.
- The third pig puts a pot of boiling water at the bottom of the chimney.
- The wolf falls in the pot. The pig cooks and eats the wolf.
Hardly inspiring right? (And maybe a tad harsh, but in the original the first two pigs were eaten by the wolf). Programming languages are not prose.
Programming languages are artificial entities, designed from the ground up to have exact definitions, and rules, which do not change depending on context. A line of code in a programming language will have either one or no meaning (the latter implies it is incorrect), for that is the context of machine logic. There are no synonyms, or analogies, nothing that alludes to historical, or cultural significance. Natural languages also evolve over time, something programming languages can also do, albeit in a more restrictive sense. Take English for example – it evolved from Old English to Middle English to Early Modern English to what we know today. If you read a piece of Old English (Anglo-Saxon), you would not understand it at all, it is closer to Latin than the English we know today. The phrase “Where are you from?” in Old English becomes “Hwanan cymst þū?”. Programming languages never change in such a drastic way. In a programming language, there is no room for improvisation, whereas human languages are more fluid, and imperfect.
Human languages involve more than just spoken or written words. Spoken languages involve characteristics such as body language, intonation, and volume. Even written languages have an aesthetic, through script or font, that programming languages don’t (okay but Courier is kind-of boring from the perspective of font – you see Courier you think code). Programming languages have none of this, but then again, they were never designed to – they were designed to communicate with devices whose emotional state is limited to 1’s and 0’s. In human languages, word meanings also change over time. The word “awful” once meant “worthy of awe”, a “clue” use to be a ball of yarn. The syntax of programming languages does not change in a similar fashion, i.e. a while does not turn into a conditional statement.
Herein lies the core difference. Programming languages were designed to convey logic, to translate algorithms from theory into reality. Human languages convey both logical, and emotional information, and are organic. Programming languages are therefore much more like Lego, building blocks of a sort. In this respect programming languages are much simpler than their human brethren.