The State of Natural Language Programming 387
gManZboy writes "Brad Meyers (and co) of the Human Computer Interaction Institute at Carnegie Mellon have written an interesting paper about the state of natural language programming. They point out that well understood HCI principles aren't finding their way into relatively new languages like Java and C#."
Proposal (Score:5, Funny)
Natural Language is not making its way into Programming
Then
Programming should make its way into Natural Language
Else
Continue
on a bumper sticker (Score:5, Funny)
YOU FORTH LOVE IF HONK THEN
And here's some filler text to compensate for /.'s sucktacular lameness filter. Blah blah blah. "It won't be any more frightening than the time I climbed up an elevator shaft with my teeth," said Sunny.
Re:on a bumper sticker (Score:3)
;)
Perl version (Score:4, Funny)
Re:Perl version (Score:3, Insightful)
Of course, what this is really doing is:
So unless there's a you method in package love, this will cause a runtime error. The following would be a little more consistant with the other examples, but less like English:
...and if you want this to run with the strict pragma in effect, you'll have to quote the string "perl", or use a scalar variable $perl.
Is this a good idea? (Score:5, Insightful)
Right now that happens - only the program gets generated by programmers (sometimes outsourced to India!)
Unfortunately, what the user says they want, and what they really want are usually very different things. Natural Language Programming really doesn't solve that problem.
The critical piece is the Designer, who sits between the end user and the programmer, and asks the tough questions: "Do you really want that? Let me explain the implications of what you just asked for." "How critical is that piece of functionality that you just added on a whim, but it just added 3 years to the project plan?" "You're asking for the data to be selected this way, but really there's no use for that - have you considered selecting the data this other way?" etc.
Re:Is this a good idea? (Score:5, Insightful)
Specialsied languages are not just for programming (Score:5, Insightful)
Programming is also something that is easier to express in a specialised language. Sure we can make some things more human readable but does that make it easier to understand? The hard part of programming isn't reading/writing the code so much as knowing what structures and concepts to use. Making programming more natural language like will not really make programming easier, you still need skill and practice. Using the music analogy again: I don't play music and can't read music score (the language of music). If Beethoven's fifth (if he ever had a fifth) was rewritten in a natural language it would not make it easier for me to play; I'd still need a whole lot of practice with a piano or whatever to play effectively. Relative to aquiring the piano skills, I expect learning to read sheet music would be relatively simple.
Where natural languaages might help is in system design and requirement capture. Still, however, I think that most often things go wrong because when people are expressing their thoughts in a natural language they use very woolly thinking and use vague terms.
Re:Specialsied languages are not just for programm (Score:3, Insightful)
In a way, the languages of mathematics and music are natural languages. Someone didn't sit down one day and enumerate all of the rules for mathematical expressions, it evolved to suit the needs of mathematicians and has retained the flexibility that results from such evolution, much like "social" languages.
It's hard for programming languages to "evolve" in the same sense since they aren't "for humans, by humans", but we do try new language designs and find that some work better than others.
Some of the mor
Re:Is this a good idea? i.e. apples vs grapes (Score:3, Interesting)
I understand that the point of this thread is to find a way to remove or to light some "translation" between
It's hard enough to find a programming job... (Score:3, Insightful)
The world will always need people who understand that asking for the last digit of Pi isn't a worthwhile request.
"Computer, sort this list of names, then beat me at chess without moving your queen, then formulate a method of reversing entropy." "Computer, tell me a joke."
If natural language aims
Comment removed (Score:4, Insightful)
Doesn't seem to say much. (Score:3, Funny)
ROFL! (Score:2)
*sigh*
Well I feel dumb. This is why I need a sign above my computer that says, "Absolutely no Internet posting before caffeine intake."
Re:ROFL! (Score:2)
Re:Doesn't seem to say much. (Score:3, Interesting)
However i did visit alice.org. I clicked on gallery and found no way to navigate back!
Seems kinda of odd that a site dedicated to "natural programming" concepts would not take the time to employ "natural navigation". Hmmmmm.
Programming in english sucks anyway (Score:5, Insightful)
Re:Programming in english sucks anyway (Score:4, Insightful)
Re:Programming in english sucks anyway (Score:3, Insightful)
Re:Programming in english sucks anyway (Score:3, Interesting)
put the sum of var1 and var2 into varX
or:
set varX to the sum of var1 and var2
or:
add var1 and var2
put the result into varX
Re:Programming in english sucks anyway (Score:3, Interesting)
Is it slow? Yeah, it's slow... no doubt. What you'd do is put the power in the methods of the objects, and just let Hypertalk tie the objects together. (For instance, Hypertalk might be too slow to negotiate a fast FTP download, but it's certainly fast enough to contain a statement like "if startDownload is tr
Re:Programming in english sucks anyway (Score:2)
Re:Programming in english sucks anyway (Score:2)
I don't know that an NL compiler would be necessarily useful, though. Programming languages are meant to bridge the gap between the human and t
Re:Programming in english sucks anyway (Score:2)
You're right. I prefer "yielding" myself, or perhaps "motivating" on a light day.
Then again, on the principle of never using a word where a polysyllabic construct will do, we could employ "entering the result into".
Then again again, if I may misquote Disraeli, perhaps I'm just inebriated with the exuberance of my own verbosity now.
Hmm. Friday mu
Re:Programming in english sucks anyway (Score:5, Insightful)
We learn math pretty friggin' soon after learning to spell. And at that point, you never write "one plus one equals two" ever again, if you ever did.
The fact is that comptur language has a closer relationship mentally to math than to english. So why not use mathematical language? Its even better, as its not tied to a single human language (who wants to translate "plus" into Swahili?)
IMHO, modern commercial languages do suck for not learning from their more academic peers (Java, I'm looking in your direction - inner classes rock, but they're no excuse for all the missing stuff).
But for "englishoid" languages, I learned VB first and then Java, and I have to say the first thing I loved about Java was the unambiguous { and } blocking.
I'm all for using natural english in the parts of programming where it belongs - like flow control, function calls, class definitions, etc. But having unambigous "this is a block" characters helps mental consistency, and using mathematical syntax helps people understand the more mathematical concepts (although the C = as assignment thing is an abomination -
Re:Programming in english sucks anyway (Score:3, Insightful)
This is true for primatives.
But for even slightly more complex tasks ("Find all the people who live in New York, and add their votes."), natural language is about as good. As the tasks get more complex, natural language ("Look for your friend in this picture, then see who's standing next to him.") quickly describes things that are formal language headaches.
Re:Programming in english sucks anyway (Score:5, Informative)
For example, they pointed out that people think about tasks in an event-driven way, their example is "when pac-man is out of lives, the game is over". But they must program by finding where in the program the number of lives goes down, and inserting the code there. An event driven language would simplify.
Their other example was that most languages make people think in loops, when they really want to operate on a group. Saying "for (i = 0; i len; ++i) { x[i] += 10; }" it a really clumsy way to express what people thought, which was "add 10 to everything in x".
Anyway, I agree that parts of the article don't sound too helpful, but they aren't talking about writing in English; they're talking about changing the structure of languages to more closely match what people think.
Oh, you mean COBOL! (Score:3, Informative)
Down that path lies madness. Or Adam and the Ants.
Fourth Generation languages expressed things in terms of the requirements, rather than the actual mechanisms involved. Such languages have been around for a while, but have largely failed in the "real world".
Re:Programming in english sucks anyway (Score:4, Insightful)
Is it any wonder? (Score:5, Funny)
Well, duh! That's because if, according to the article...
> The goal is to make it possible for people to express their ideas in the same way they think about them.
#include // Do What I Mean
thingy main (thingy list) { Sort thingy // wave hands
No, like this
With the guy's name on the right
No, I guess the middle initial deserves its own column. No, I didn't think of that.
But don't print the middle initial.
No, not like that.
Eew, that font sucks.
Yeah, like that.
No, like it was before.
Yeah, no--wait. I gotta talk to my boss.
He said to do it like this.
But he didnt like it.
Fuck this, I'll pay some guy in India to do it.
}
Re:Is it any wonder? (Score:2)
Natural Programming != Progrm. in Natural Language (Score:3, Informative)
The article is talking about new programming paradigms, which deprecate the old Von Neumann architecture programming model and allow for a more flexible mindset while programming. Last generation scripting languages (Python, Ruby...) would be a step in that
Re:Is it any wonder? (Score:2)
Donald A. Waterman, Allen Newell: PAS-II: An Interactive Task-Free Version of an Automatic Protocol Analysis System. IEEE Trans. Computers 25(4): 402-413 (1976)
which, considering the state-of-the-art then (it was PDP 10 [wikipedia.org]) times was performing not too bad (as I thought then).
Starting from there, I think it would be feasible today to come up with s. th. conforming to "HCI-ideas" more than particularly java which could tackle the DWIM-problem a little bett
Not gonna work (Score:5, Funny)
John.
Re:Not gonna work (Score:2)
What are you saying? Natural language on /. is da bom. L337sp33k R0x0rz m8!
Closest I've found to Natural Language... (Score:2, Insightful)
But natural language requires more typing than say C syntax.
A EQUALS B
A = B
But does the thought process get speeded up. If so one needs to know how the gains and loss affect overall development.
Good point! (Score:5, Insightful)
Natural language, while easier for beginners, would make for horribly inefficient code and would be undesirable for any sizeable application.
Re:Good point! (Score:2)
Re:Good point! (Score:2)
As for 100x slower than C not being bad- I take it you're willing to pay for all my future hardware upgrades? If not, then its bad.
Lisp is natural (Score:2)
For economy you cannot beat:
Re:Lisp is natural (Score:2)
I'll admit that the consistency of syntax is wonderful, but that's no excuse for
a) not having any built-in facility for BEDMAS-calculation. Some sort of standard macro for that is sorely lacking, and if its there, then the tutorial writers have to stop ignoring it - its absense is one of the language's biggest failings.
b) totally obtuse keywords. Yes, you learn what car and cdr mean pretty fast, but they're only the beggining of Lisp's obfuscated
Re:Closest I've found to Natural Language... (Score:2)
You mean like: Hey, that's a nice piece of code, maybe it'll help me out here <clickety>. Or something moore complex like envisioning the interworkings of a whole system in your head and trying to turn that into something useful based on recalled behaviour of snippets of symbols...
I just don't think natural language meshes well with solution space. At best it might be useful for high-level specification.
except... (Score:2)
You ought to say "put the value of b into a"
[/nitpick]
I don't buy it. (Score:5, Insightful)
jeff
Re:I don't buy it. (Score:5, Interesting)
I would love to see some numbers on the frequency and nature of bugs in software, and I want to see these numbers broken up by language as well as by appliction domain. I suspect that a comprehensive collection of such statistics doesn't exist, since I haven't seen any empirical data enter into the various debates to which they would apply.
Until someone spends some more time researching this information, I doubt that the development of programmign technology will advance in a fashion any more directed or smooth than science and technology did back in the fourteenth century.
Re:I don't buy it. (Score:2)
Basically it comes down to two things: time and money. Developers aren't going to spend the time to study their own bugs and development models, except when and where it helps them write better software faster. Stan
Re:I don't buy it. (Score:2)
Besides, we shouldn't be working from case studies in corporations, because that would make it darn hard to do any sort of experimental controls. On the other hand, it would be easy at CMU because they have a big stinkin' pile of undergrads that they can force or pay to s
Hmmmm (Score:3, Insightful)
On that site, there's http://www.alice.org/whatIsAlice.htm [alice.org] which says
So, this is just like Visual Basic. I know that can't be true, or else Microsoft would be marketing VB as NLP. So what am I missing?
Re:Hmmmm (Score:2)
VB makes creating GUI-based applications quicker (and easier, many say) by allowing you to create the user interface in a visual fashion and then attach code to the visual elements. You still have to get down there and type code though to make the application do anything aside from some "canned" interface functions.
Alice, OTOH, i
Oh NO! Not Again! (Score:3, Insightful)
Multiply x by y to get something or the other
Re:Oh NO! Not Again! (Score:2, Insightful)
(Or SQL for that matter. We managed to finally obsolete COBOL more or less, but SQL is still with us.)
Anyhow, the idea behind the COBOL Natural Language push was to rid the need for programmers or at least greatly reduce their training. However, it was found that somebody with some training could translate business logic into something that the computer could understand better than amatures. In other words, with some training productivity was so much higher than some manager trying to be
How about this? (Score:2)
"Computer?"
"Working"
"Program the holodeck to look like the inside of a seedy 1920's era Jazz Club. We need to write another time machine episode."
Re:How about this? (Score:2, Interesting)
Natural language programming. (Score:5, Insightful)
An interesting read.
Re:Natural language programming. (Score:2, Funny)
(it's a joke, people!)
Write a Natural Language Compiler (Score:5, Interesting)
Personally, I don't see how creating a language that encourages this behaviour can be a good thing. Isn't this the point of learned programmers? The ability to translate real world situations into easy to understand processes? Then again, I'm no language development guru.
People think in their languages. (Score:4, Insightful)
I'd imagine that a "natural language" system could be developed with different approaches based on the native tongue of the programmer, but I would think this would damage the benefits of commonality that other languages now enjoy.
Re:People think in their languages. (Score:2)
Yeah, like maybe the programming language itself? Maybe it's just me but I think in whatever programming language I'm using. It's so much harder to try to convert data structures and algorithms to a natural language, or vice versa. The best we can hope for (in my opinion) is people usin
Re:People think in their languages. (Score:2)
Actually, that's precisely what I was referring to (see the following sentence in parentheses).
Maybe my natural language wasn't clear enough.
I didn't RTFA... (Score:4, Insightful)
That's about as far as I got. I guess he didn't really express his ideas in the same way that I wanted to think about them.
Which nicely illustrates the point that there's always a "semantic gap" associated with natural languages, which builds up because people have different ways of thinking. The semantic gap is even wider when one of the entities being communicated to happens to be a machine. There's a reason why traditional programming languages are precise and exact...it's so that the gap is reduced - the machine will do exactly what you tell it to do...even then we have a disconnect between what the programmer's thinking, and the code that he's writing.
Re:I didn't RTFA... (Score:2)
Natural Language isn't for Serious Programming (Score:4, Insightful)
Ah, I see the problem... (Score:3)
Remember Apple Script (Score:2)
Re:Remember Apple Script (Score:2, Insightful)
I think you really mean the opposite of what you said. The syntax of natural language is bogglingly complex. You can express the syntax of even perl with a few kilobytes of EBNF. Noam Chomsky tried to come with formal syntax rules for spoken languages and utterly failed (though his work is what led to BNF and compa
Re:Remember Apple Script (Score:3, Informative)
Re:Remember Apple Script (Score:3, Interesting)
Not that it's not powerful and fairly easy to use ( you can do a *lot* of fairly amazing stuff with AppleScript that can't really be done otherwise ), but it is _not_ as straightforward as it should be... doing something relatively simple, like string manipulation, just isn't easy. How do you take a path name and add a few characters to it? It's kinda hard to figure out.
Of course, you could blame some of AppleScripts' difficulty-of-use o
What is the PURPOSE of natural language? (Score:3, Insightful)
Would would any programming want to code in english? To me this:
myvar++
makes more sense than:
increase the variable myvar by one please
Do we really want people who can't understand something as simple as "myvar++" to be programming in the first place? Seems to me we NEED a barrier to entry. There're enough lousy programmers out there already.
The problem is (Score:2, Insightful)
The fact is that people don't care what's academically sound, or what people have "proven" is the best way to do things. In fact, the things people do care about are directly contradictory with what's academically "best". It isn't some kind of head-slapping coincidence that the new popular languages ignore "natural programming
NLP (Score:2)
from the =-NE-== dept. (Score:2)
=-NE-==
Mean?
Re:from the =-NE-== dept. (Score:2)
= (the assignment operator) is not equal to == (the boolean equality operator)
Re:from the =-NE-== dept. (Score:2)
It's a pun on programming languages.
Some use the symbol = for equality, as in a=b is true if a and b are equal. Others use = for assignment to change a variable's value, and so use == for equality, so the above test would become a==b.
The -NE- is a dig at FORTRAN programmers, I assume. (NE = not equal.)
Re:from the =-NE-== dept. (Score:2)
In fortran90 they added
Wow. (Score:5, Insightful)
We've had a lot of posts about "OH NO! COBOL!" Yes, yes, I agree with you -- pretending to be English usually results in awkward and unnatural syntaxes. One of the advantages of a formal syntax like most programming languages is that it clicks the brain into a different mode. (How many of you can read sigs like 2b||~2b? I thought so.)
But that's not really the paper's main aim. It makes a couple of notes that all of us, particularly those of us in language design, could benefit from.
1. People tend to deal with collections in the aggregate far more often than they step through them an item at a time. The example given was "set the nectar of all the flowers to 0." Look past the syntax for a moment and look at how simple that is.
2. Debugging the traditional way sucks. Did anyone actually read that bit at the end about the 'Why?' questions, and look at the screenshots? Holy crap. That's really impressive.
Of course, I may be biased, because the points made in the article are basically the same that underlie a language I'm currently designing.
Do any languages support Natural Language? (Score:2)
set the nectar of all flowers to 0??? (Score:2)
for (int i =0; i < flowers.length; i++) { flowers[i].setNectar(0); } or something like that.
But wouldn't the most natural way be to say something like "no flowers have nectar"? This gets into a completely different level of parsin
Re:set the nectar of all flowers to 0??? (Score:2)
foreach( flower in flowers) do { flower.setNectar(0); }
Re:set the nectar of all flowers to 0??? (Score:2)
I'd rather read something like
apply (set_nectar 0) flowers
Assuming a suitable functional-style language where it's well-defined, this is a clear and concise instruction, unlike the example phrase.
Deterministic vs. nondeterministic (Score:3, Insightful)
The real problem is a lack of strong domain models for most real world situations. That is, if you're starting a project to emulate something happening outside of a computer, then there's a very large likelihood that you're going to have to build your own object model to describe the situation to the desired level of accuracy. Once you have that model, it's easy enough to say "do this until that happens", but there's a world of difference between that point and staring at a blank screen at the beginning of a project.
There's been some progress (depending on who you ask) to make this easier for those who aren't full-time programmers, such as UML and related design tools, but even these are mainly limited to building a high-level template of the final result so that a human can manually implement all of the details.
This may or may not be avoidable. Vernon Vinge (author and CompSci professor) refers to the "Age of Failed Dreams" where humans eventually concede that some things just aren't possible. Expecting a current deterministic Turing device to be programmable at the level where people interact with each other may very likely be one of those areas.
Brad Cox spoke at RubyConf 2004... (Score:2)
Anyway, he had some interesting things to say about micropayments; a summary of his talk is at the bottom of the page in Jim Weirich's blog here [onestepback.org].
English and Computer Language dont Mix Well. (Score:4, Interesting)
Make a List with the values 1, 2, 3, then this is a list of 2,4,3,2, now we are back in the first list with some more values of 5 then 2, now we get an other list inside this list as 2,3,5,6 Now we finish both list.
As you see in english this is clumzy I am sure someone with a better master of english may be able to make it a little more percise but still just giving up and using the () makes it a lot easier to see and understand then using a bunch of words.
Most human languages were made Thousands of years ago. And came from languages 10s of thousands of years old if not Millions of years old. They were not designed for micro processing of infromation. They were required for more common sience reasioning. Which we as humans often fail a lot at and imagin how poor a computer would be a common sience.
What is natural language? (Score:3, Insightful)
I understand that the goal is to have the user just tell the computer what to do in English. The problem is that English is not precise and is too ambiguous. I don't know if I would want to fly on an airpline if I knew the computer on board was programmed in English.
Not "Natural Language Programming" (Score:2)
IMO, the best direction for natural programming is embedded domain-specific languages [yale.edu]. The best direction for natural debugging is a harder prob
MOD PARENT UP (Score:2)
Mod parent up! (Score:2)
Finally, someone gets the point. :-)
Programming languages that allow writing high level code using concepts close to the application domain are simply more powerful than those that force the programmer to convert between the application domain and the computational facilities of the language all the time. Some languages support writing higher level code this way much better than others, and this is where a lot of the research behind the next generation of languages should be going.
standard flaw in research like this (Score:3, Insightful)
Great, I accept that a new language can make toy problems easier.
However, I think the situation is very different when you have a real programmer working on a real program. Writing a real application, like a word processor or a web browser, is difficult no matter what language you do it in -- and I would argue that the difficulty doesn't vary much between languages. In fact, I would further argue that many of these research languages, while making toy problems easier, would actually make "real" programming substiantally harder, because the semantics of the language are not as formalized and thus more difficult to remember and deal with.
I'm certainly not opposed to advances in language theory and design -- our modern-day large applications would be essentially impossible to write if all we had to work with was machine language. But to be a major advance, a new language should focus on making real problems easier for real programmers, not making toy problems easier for non-programmers.
Re:standard flaw in research like this (Score:2)
Obviously, machine code (or BrainFuck) is enough of a difference to have a real impact on difficulty, and I accept that a super-duper-high-level language could make the process substantially easier, if a suitable one existed (but it d
Tourette's: the natural language of programmers (Score:2, Funny)
Then they execute the code for the first time, see the results, and scream out SHEEEIIIIT, GODDAMN IT!!!
Hence, to an outside observer, the natural language of programmers is indistinguishable from a case of Tourette's Syndrome.
but _WHICH_ natural language? (Score:3, Insightful)
I know that natural language is creeping into UI's in specialized search engines. If you know where to look, you will find natural language search features on Fidelity.com and perhaps other financial websites. These are much more carefullly bounded problems than the broad challenge of allowing a user to express a solution or algorithm for an arbitrary problem a computer could be programmed to do in, say C, but using ordinary speech. The article sited is interesting and it might make life better for us programmers but I am not getting my hopes up that more than incremental change to computer languages is around the corner.
Flowcharts (Score:4, Insightful)
Re:Flowcharts (Score:3, Informative)
Natural language does not... (Score:3, Insightful)
Natural language compilers?are they kidding??? (Score:3, Insightful)
We humans don't even talk logically at times (logically in the mathematical sense). We say one thing, we mean another one. One of the most difficult things for new students is to get used to the strictly mathematical nature of computer languages. Computer thinking requires every bit to have its special meaning in the universe. Most people choke on that. The most capable programmers are those that can hold a mental model of the application, its various parts and as a whole. These types of people can translate requirements to code very efficiently, because they can reason about a program's state better since they remember the whole program and they can immediately recognize the consequences of any programming decision.
And when one becomes familiar enough with the way the computer works, then the verbosity really gets in the way.
What we need is a development environment that can reason about the state of the program. That's the root of all problems. Embedding state information in a program is something I haven't seen in any language. Most languages, if not all, work in the assumption that anything can happen anytime, and they don't have state constraints, thus allowing the programmer to make mistakes that could be cought in compile time.
Re:Other languages... (Score:2)
Some 17 years ago ... (Score:4, Informative)
Granted, it was by no means a fast runner, but you could write more or less plain English to it: Who could possible be confied by this code?
Notice the brilliant little keyword called "it", that you could use with "put" and "get". Neat, simple, easy!
eulogy [pacificavc.com]
HCL, HCl, or HCi? (Score:2, Informative)
HCL (Hilbert Class Library) has little if anything to do with HCi (Human Computer Interaction) or HCl (hydrochloric acid). The article is about HCi.
Re:HCL, HCl, or HCi? (Score:2)
Evidence here [hcibib.org]
CC.
Re:AppleScript, anyone? (Score:3, Insightful)
Re:Applescript (Score:5, Interesting)
The solution of course was to tell Apple Script that regardless of what hapens, just issue the open application command and stop caring. I spent a good hour or so digging through documentation until I finaly found how to do this, and the answer is so blaringly obvious that it makes one feel stupid when they realize they should have known it all along: That's it.