6

I recently saw a programming language called supernova and they said in the web page :

The Supernova Programming language is a modern scripting language and the

First one presents the concept of programming with direct Fiction Description using

Clear subset of pure Human Language.

and you can write code like:

i want window and the window title is Hello World.
i want button and button caption is Close.
and button name is btn1.

btn1 mouse click. instructions are
   you close window
end of instructions

my question is not about the language itself but it is that are we need such languages and did they make writing code easier or not?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Mohamad Alhamoud
  • 4,881
  • 9
  • 33
  • 44
  • 35
    I would rather program in plain x86 assembler for the rest of my life than write a project in this language. – lamas May 01 '10 at 17:45
  • Mmmm... writing eCommerce apps in x86 assembler. Reminds me of some of the stories I was hearing about banks back in the early '90s. – Donal Fellows May 01 '10 at 17:54
  • 3
    does it raise exceptions like "you suck!" and "epic fail lolz" i wonder – fearofawhackplanet May 01 '10 at 18:47
  • 2
    Does it start with "IDENTIFICATION DIVISION"? – mpez0 May 01 '10 at 19:31
  • @mpez0 NO, because it should start with ENVIRONMENT DIVISION. –  May 01 '10 at 19:36
  • This reminds me of the scripting language used in Toolbook. I once worked on a large business app written largely in Toolbook (for developing Win 3.1 apps) and we migrated toward Win32 by thunking with 32-bit 'servers' running the logic that would no longer fit in the book. It was very...interesting. – Dan Bryant May 01 '10 at 20:27
  • 3
    More seriously, I'd expect this as description from users: `I want a box called Hello World and a thing in it called Close and when I click it it vanishes.` Which should do exactly the same thing. – Donal Fellows May 02 '10 at 08:13

10 Answers10

19

The code may look like natural language, but it's really just regular computer code with different keywords. In your example, I want is probably synonymous with new. It's not like you can use natural language directly and say make me a window instead (and if you could, things would get even uglier...).

Lets take a close look at your code and the language implications:

i want window and the window title is Hello World. 

i want means new, and denotes beginning of the argument list. the <type_name> <member_name> is sets instance variable member_name on the object being created. Note that you have to write the type_name twice.

i want button and button caption is Close.
and button name is btn1.

. ends a statement. However, you can 'chain' method calls on an object by starting the next statement with and. Also, how do you refer to a variable named Close instead of the string "Close"? Heck, we even have this problem in regular English: what the difference between 'Say your name' and 'Say "your name"'?

btn1 mouse click. instructions are
   you close window
end of instructions

mouse click is an identifier containing a space, should be mouseClick. instructions are defines a lambda (see the is vs. are keyword confusion causing trouble yet?). you close window calls window.close(). end of instructions is end of a lambda. All of these are longer than they need to be.

Remember all that? And those are only my guesses at the syntax, which could be completely wrong. Still seem simple? If so, try writing a larger program without breaking any of those rules, AND the additional rules you'll need to define things like conditional logic, loops, classes, generics, inheritance, or whatever else you'll need. All you're doing is changing the symbols in regular programming languages to 'natural language' equivalents that are harder to remember, unnecessarily verbose, and more ambiguous.


Try this translation:

var myWindow = new Window( title="Hello World" );
myWindow.addButton( new Button( caption="Close", name="btn1" ) );

btn1.onMouseClick = function() {
    myWindow.close();
}

See how each line maps to its counterpart in the previous example, but states the intent more directly? Natural language may be good for execution by humans, but it is terribly difficult to use for precise specifications.

The more you try to make English communicate these ideas easily and clearly, the more it's going to look like programming languages we already have. In short, programming languages are as close to natural language as we can get without losing clarity and simplicity. :D

Gordon Gustafson
  • 40,133
  • 25
  • 115
  • 157
  • 8
    Of course, your translation magically pulled out of the air the fact that the button is supposed to be in the window. Totally unstated (though correct I believe). That's one of the *real* problems with programming in natural languages: there are vast numbers of unstated assumptions which totally change what's supposed to happen. I'll be charitable and call it a “tricky AI challenge”… – Donal Fellows May 02 '10 at 08:09
13

Since the fundamental difficulty of programming is getting your thoughts ordered enough to tell the computer what to do, making the language more “natural” is highly unlikely to make it more accessible to non-programmers; the language itself was never the real problem in the first place. What's more, all that extra clutter of natural language doesn't help any programmers (worth the name) with what they're doing either, so why add it?

Or can we have a real natural language programming language, complete with “Um”, “Er”, and “Oh, I don't really know”? :-)

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
  • 5
    The natural programming language you mention is the one used by customers to express their intent to programmers. It's reserved key-phrases include "automates our process", "meets all requirements" and "improves productivity". These may or may not be used in conjunction with concrete objects to further describe the intent. In most cases, it is used as a query language, with a final function evaluating to "how much will this cost?" or "how long would that take?" In some cases the query is omitted and an assertion is used, such as "This must be complete in two months." – Dan Bryant May 02 '10 at 00:38
  • @Dan: That's not a programming language at all. It's a set of ranked constraints, often badly expressed and incomplete. – Donal Fellows May 02 '10 at 08:02
  • 1
    Donal: Stating the obvious... You have an abundant lack of humour. :) – asdf Jun 20 '11 at 16:49
7

Edsger W. Dijkstra, On the foolishness of "natural language programming". I have nothing to add.

PetrV
  • 1,368
  • 2
  • 15
  • 30
Wildcat
  • 8,701
  • 6
  • 42
  • 63
5

The programming language you have showed us above is extremely verbose (as it seems even more than COBOL).

This comes with several problems:

  • It takes long code to do simple things.
  • Code grows unmaintainable fairly fast
  • It takes long to find out what code does
lamas
  • 4,528
  • 7
  • 38
  • 43
  • And the other point is that it doesn't *really* help non-programmer to understand what the code is doing ... let alone make it easy for them to write their own applications. Experience with COBOL clearly demonstrates this. – Stephen C Aug 24 '14 at 02:21
3

Whether they're better or not is opinion, but that looks like some mutated cross of COBOL and BASIC, which is most definitely epically bad.

So in my opinion, no. I think somewhat to-the-point languages that still use readable verbs/adjectives/names are better (C++, C#, PHP, etc are my preferred languages).

Some languages start to get too high-level and/or verbose, making the actual logic so abstracted it's hard to know what does what. Some are too low-level and brief, forcing you to explicitly state everything you want done. A balance between readability and brevity, with power and flexibility, is what is best for development.

ssube
  • 47,010
  • 7
  • 103
  • 140
3

I'll be brave and offer a slightly different opinion here.

I haven't seen anything of this language other than what has been presented in the question, but looking at that I'd have to say it probably is much more readable for a non-programmer. For a programmer on the other hand it won't hurt readability, but it won't help either because we're used to reading code.

On the actual development side of things, I think it would be horrible to have to type so many extra bits especially if you're used to succinct keywords and constructions like us programmers.

But let's imagine a far away future where speech recognition is actually accurate. I think a language like this would be far easier to code by talking to your computer, I'd hate to have to specify every parenthesis and such. Not having to do that would help keep your train of thought.

In conclusion:

  • non-programmer readability: great.
  • programmer readability: no improvement.
  • codability typing: no, just...no.
  • codability speech: probably much easier.
NomeN
  • 17,140
  • 7
  • 32
  • 33
3
person.eBusiness[text.this.author].like(language.supernova.idea.reverse);
language.English[ambiguous[very]];
person.eBusiness.suggest(create(language.Codetalk));
language.Codetalk.grammar.inspiration=language.programming.grammar;
language.Codetalk[new,better,ambiguous[not]];
if(person.all.use(language.Codetalk)){
    person.all.understand(person.all.communication);
};
question(language.Codetalk.idea[good]);
aaaaaaaaaaaa
  • 3,630
  • 1
  • 24
  • 23
2

In my opinion there is no really useful advantage in using that kind of "human language", because you still need a syntax and special words. You have to learn both of them, and because that's necessary it would be not much more difficult to learn a "programming language", which gives lots of advantages because it is oriented at the machine's structure and not at the human's way of thinking.

You will need to think the way the machine works if you want to write good programs, and a programming language is definitely more powerful to express that way of thinking than human language.

user329974
  • 41
  • 5
1

One problem with these languages is: Say you write significant portions of your app in this language and then need different people to maintain,extend or otherwise change the code.
Who are you going to get to do this ? Nobody off the street is going to know it and others are going to have a steep learning curve.
Let's also assume you have a question on how to accomplish a task the language, where do you turn ?

Romain Hippeau
  • 24,113
  • 5
  • 60
  • 79
0

Well the perfect programming language would be an exact copy of the English Language. You could just tell your computer to do some stuff in the same way you might order a coffee or give homework to your class. However, such a language would be extremely difficult to implement (an advanced A.I would be necessary).

user2850249
  • 169
  • 9