Musings

Oct 29, 2009 09:13

I've been thinking about how programming is similar to other disciplines lately and my most recent one is that I think programming languages share a fair amount of similarity with natural languages. Sure there's the practical component of them being created for a purpose (and being created at all I guess is a difference, unless you count Esperanto or other similar attempts) but even though they are initially created, the languages evolve over time.

The "success" of a language also depends highly on social factors. Languages become popularized when they have a community around them, and it's usually the creators' job to also create that community. There's also corporate backing of course, but there's a lot of history behind programming languages. Java which is now almost ubiquitous was never originally designed for the PC (or Mac!). SmallTalk (which I've never used) was designed to be a simple language meant for educational purposes and targeted at kids, but is now evolved enough that it can be and is used in some more serious business environments.

Languages also differ in verbosity. While most general purpose programming languages (as opposed to domain specific languges) are "Turing Complete" meaning that they can express the same technical ideas, many ideas are just much more natural in some languages than others. Similarly human languages can express the same ideas, but there are still things that are hard to translate directly such as subtlety of connotation and idioms. Both programming and natural languages also shape how the mind works in them. It's easier to think or reason about things when the idea is understood and defined in a word or two rather than a whole paragraph.

One thing that brings the worlds closer together is that the technical constraints of languages are lower now than they were back in the 70's and 80's where you were literally counting characters and trying to make your programs fit in as little memory as possible. Now being easily understood by a human is at a pretty close 2nd to correctness and in 90% of cases is far above performance (generally speaking 90% of a program's time is spent in about 10% of the code, so most of the time readability is far more important than speed these days) You're no longer limited to single letter variable names (although different languages also have different conventions for how long they should be, I've seen some that are 10 words long) so it's easier to write in such a way that is easier to understand. I've never read it, but Donald Knuth did something known as Literate Programming that is quite verbose and many claim is pleasant to read. I'm reading a book of a collection of interviews with some top programmers and when asked how they read Knuth's "TeX: The program", they said "Like a book" in that it could be read cover to cover. That's a rather extreme view, but it shows that it can be done.

I wonder if many linguists do or would be interested in studying programming languages in addition to natural languages.
Previous post Next post
Up