Well I suppose I’m a programmer now. Of all things.
It’s not what I expected, to be honest. I still associate the word with men in lab coats and bow ties in front of banks of flickering lights, doing arcane things at rattly teleprinter terminals. Something to do with rockets probably. Robots even. And punched paper tape!
Punched paper tape was amazing, I used to collect discarded lengths of it from offices where my mother worked as a temp. Its perforated patterns are the perfect metaphor for the state of computing when I was a child. Pretty, delicate, clearly meaningful and yet profoundly mysterious.
These days? It’s writing really. You’re using language, a kind of language, to convey your intended meaning. Like much writing it’s part creativity, part drudgery and repetition. Long-separated senses of the word “hack” meet by surprise in a foreign city.
And like their natural counterparts, programming languages are a pretty diverse bunch. But you’ll hardly find two more different than the ones I just certified in – SQL and PHP. They’re like Choctaw and Chinese. Or more helpfully, Latin and English. One is (relatively) ancient, dusty and rule-bound, the other young and a bit anarchic.
Strangely though, it’s the old one that was actually designed to be English-like. And in the time of the lab coats I guess it seemed like it. A SQL command is called a “statement”, and is constructed much like a sentence:
Select roses, tulips from basket join bouquet where colour = "red"
Sounds almost like the real thing, doesn’t it? But…
Select camel, serendipity from D547 join moonslip where fandango = "buttocks"
…is equally meaningful. The resemblance to human language is superficial for a reason: In SQL there is only a handful of verbs, representing the very limited set of things you can do with items in a database. Its ‘nouns’ are little more than arbitrary labels. Real language is almost immeasurably more complex than that.
The thing that makes SQL seem completely unnatural though is its obsession with data types. These are important up to a point of course. You need to know what kind of data you’re dealing with, whether it’s numbers, “string” (which is what programmers like to call written words), dates and times, or more exotic stuff. You can’t add a word to a number or multiply a date.
But in SQL these break down into seemingly endless subtypes: For a number you need to know what the base is, whether it has a decimal point, if it’s positive or negative. With words it matters what the language is so that the right characters are used, plus you need to know what alphabetical order is for those characters, whether case is significant and so on. Dates and times are available in a mind-bending range of formats, depending on, say, whether you’re more interested in events since 1,000 AD or 1970.
Where it gets ludicrous is that there are still further subdivisions, into units of different size. (My favourite is called the Binary Large Object – or for short, BLOB.) The idea was to set aside only as much space as your data is going to need. If you have a column wide enough for six-figure sums and then enter numbers in the hundreds, you’re effectively saving blank decimal places to your hard disk. In the ’70s, disks were expensive. There was no room for empty space.
Compared to this, PHP seems like it was invented by hippoes. (I meant to say hippies there but I’m going to leave the typo in.) It’s just so… relaxed, skipping lightly over the very things that make SQL tedious. It seems to just guess what your data type ought to be. “You’re trying to add a number and a letter together? No problem, let’s see what happens.”
What makes it even more like human language though is the fact that it’s “Object Oriented”. This is a big idea so I’ll leave the details for another post, but suffice it to say that like real nouns, an object in OO programming is meant to represent something in the world. As such it comes with its associated “verbs” (known as methods) that represent the actions characteristic of that object. So the things that exist in your program have hidden powers that you can call upon if you know the right words. Cool.
Perhaps the best comparison then is not with different natural languages, but with different specialised jargon. Moving from SQL to PHP feels a lot like leaving contract law to take up alchemy.