Glass Maze Every jumbled pile of person

Posted
20 March 2007

Tagged
Geekery

Programming in English is a Bad Idea

Here’s a very cool insight from a reddit thread I was just just noodling through:

A programming language should never try be intuitive. Visual Basic tried to be intuitive. Applescript tried to be intuitive. Both wound up more confusing than they [should] have been. Programming just isn’t intuitive, there’s always a learning curve. Instead, good languages are consistent and make sense. Predictability is the best way to reduce (not eliminate) the learning curve.

I think there’s a notion out there that computer languages should be easy to learn, or easy to use, or whatever, and so you sometimes get languages with syntaxes that try to be as English-like as possible. The theory being that if you can program the way you talk, everyone will be able to program.

It doesn’t work, it never works, because programming is just intrinsically hard, and languages that try to paper over that difficulty with insipid abstractions or faux-familiar syntax just wind up muddying the water further. Programming languages should make it easy to express stuff the way you think about them, not the way you talk about them.

Because human language is intrinsically imprecise. It has to be: there’s no way to capture our cognitive landscape with words, which is why we often keep things vague, or use metaphor and symbol to get at fundamental but inexpressible truths.

That’s certainly no model for a computer language. When a program comes across something inexpressible, it doesn’t search for an extra-lingual abstraction to get around the difficulty. It dumps core.


3 Comments

Posted by
Alan
28 April 2007 @ 4am

Hey – could you make this box a bit bigger, I feel a rant coming on. Anyway back to your post …

Sorry to disagree, but your post shows sloppy thinking in a number of respects:

Firstly “Programming in English” is not the same as programming in “languages with syntaxes which try to be as english-like as possible”. (So you can dump your title to start with.) There is no programming language with natural syntax, and “as English-like as possible” is still (2007) very far away from “like English”.

The opinion that programming is hard is not a good reason why English should not be used for it – can you think of any other hard problems which English cannot be used to describe ? Like philosophy, theoretical physics, cognitive science, … it seems that English has been used to cover all the hardest problems we’ve met so far, and certainly far more of the hard problems then the weeny subset covered by programming languages.

Similarly – all the fundamentally hard areas within programming have been well expressed in English, for example http://www.amazon.co.uk/Art-Computer-Programming-Information-Processing/dp/0201485419/ref=pdbbssr_1/026-2350682-0636425?ie=UTF8&s=books&qid=1177732800&sr=8-1

BTW – do you have any empirical data to support your opinion that programming is hard ? Seems easy to me. Too bloody time-consuming, so I never get to the end of the issue list. But it is the finickitiness of the computer system (including languages) that makes it slow, not the actual problem-solving.

Not sure about you, but it seems to me that the way I think about something is a very close parallel to the way I talk about it. And when conversation is flowing the two modes seem ad idem. After all – if you cannot express the solution to a fellow developer, you can hardly express it to a machine. And if you can’t express it to a customer, it’s fairly pointless expressing it to a machine.

English language is not inherently imprecise: “This is a comment on your blog post” – where’s the imprecision? Just because English can be used to imprecisely express some ideas, does not mean it must be used to imprecisely express all ideas.

Could you define “inexpressible truths” ? Please give an example, without being able to express it, but still showing that it is a truth. Go on, I dare you.

And, OTOH, when the ideas are inherently imprecise then how would you write a program to evaluate the beauty of a sunset, or measure the “quality” of a program ? And how would having a “precise” programming language help you with this task ? So how is that any less reason to use English as a programming language?

Your final paragraph is a poorly thought out attention grabber because a) Programs cannot come across something inexpressible. By definition programs consist of only expressed statements and data. Those statements/data may be wrong, but they are all expressed. b) Surely a language which allows looser expression leaves less concepts inexpressible ? There are far more ideas directly expressible in English than there are in LISP. c) “dumps core”? Oops – I should have realised you were stuck with primitive languages before commenting. Sorry about that.


Posted by
TheNightFly
13 May 2007 @ 11pm

I’ve been studying programming languages for years and the fact is, there is absolutely no reason why high quality programming can’t be done with simple, unambiguous English statements. The fact is, academics and professionals don’t want to make programming easy because it would threaten their livelihoods. Anyone who ever failed to develop an English-based programming system was either incompetent or gave it up after realizing the long term consequences. I am in the process of developing my own purely object oriented programming system based on the use of intuitive and unambiguous English statements and proper punctuation. So far, it’s working much better then expected and I’m planning to publish my first compiler for it very soon. Cheers! :)


Posted by
lapsed.cannibal
14 May 2007 @ 2am

Nightfly — congrats on your upcoming language and compiler, that’s excellent news. I could just be blowing smoke out my ass with all this, of course — and I’ve certainly never written a whole language to test my hypotheses — but I can’t get over the notion that English just isn’t suitable for this kind of work. The language is inherently fungible, and different people can reasonably interpret the same statement in different ways. Not so with an artificially constructed language. John Gruber has a long article about this problem with respect to Applescript (http://daringfireball.net/2005/09/englishlikeness_monster).

Buy anyway — congrats again on your new language. Hopefully you’ll soon prove me wrong.


Leave a Comment