5

Basically in both cases you have:

  • a well defined vocabulary
  • a syntax to respect
  • they both can express a business logic
  • they can define semantics

I don't think that will be fair to say "A programming language is only useful for a PC" or something like that.

I just can't find a real answer, but we can feel the difference, it's strange.

gnat
  • 21,213
  • 29
  • 113
  • 291
user827992
  • 1,175
  • Isn't the purpose of each quite distinct? – NoChance Jun 29 '12 at 23:53
  • 14
    I dispute the claim that English (or any other living human language) has a well defined vocabulary. Not only do many English words have multiple dictionary meanings, popular usage can turn them entirely upside down. For example the slang usage of "sick" meaning excellent, and the popular if errouneous usage of "nonplussed" as "not bothered" or "not surprised". The lack of a well defined vocabulary is one immediate difference between human languages and computer languages. – Charles E. Grant Jun 29 '12 at 23:55
  • @EmmadKareem ok they are distinct, how you can define that, just answer to the question in scientific or pseduo-scientific way. – user827992 Jun 29 '12 at 23:59
  • @CharlesE.Grant every language will develop a dialect, defining a vocabulary is the root of every language. – user827992 Jun 30 '12 at 00:00
  • @user827992 I didn't say otherwise. I just dispute that in human language it remains well defined. We mostly get along quite well in human language accepting even contradictory meanings for words, and deriving meaning from context, tone of voice, and body language, or even just the fact that the defined usage makes no sense in context. In a computer language a keyword can have one and only one meaning. Try naming a variable 'for' or 'while'. – Charles E. Grant Jun 30 '12 at 00:06
  • 3
    Since when does English have a well defined vocabulary? There's an entire SE site, English Language & Usage, devoted mainly to figuring out what words mean and how to use them. Also, you can bet there there are many differences between human languages and computer languages, not just one. – Caleb Jun 30 '12 at 00:14
  • @CharlesE.Grant - "In a computer language a keyword can have one and only one meaning" - this is feature, not a limitation of a programming language. It's easy to define a formal language that can contain keyword level ambiguity, it's just advantageous not to for many reasons. – spinning_plate Jun 30 '12 at 00:18
  • @Charles E. Grant : Yeh, right..... – mattnz Jun 30 '12 at 00:27
  • Another important difference: programming languages are specifically designed to exclude ambiguities. Natural languages are not, as illustrated by the famous "Go buy one carton of milk, and if they have eggs, buy 6". – K.Steff Jun 30 '12 at 00:35
  • 2
    @Charles E. Grant : Yeh, right..... (Just to prove your point) - In my country, usually means I don't believe you, but both the words agree with you. Thats same as a C++ like language having a statement x += +y; meaning x = x-y most of the time - depending how what the lines before it are. The fact that English (an other spoken languages) is not precise enough is why we have programming languages. This is not confined to computers - Matheticians, Chemists, Engineers, Phyisist and even Lawyers (Have you ever read a legal document?) have a language that is not English. – mattnz Jun 30 '12 at 00:41
  • English: "Fruit flies like bananas". Can you even break this into nouns and verbs using a computer? – Martin York Jun 30 '12 at 13:14
  • How is this not constructive? It's a very interesting question with answers rooted in current literature surrounding programming languages and natural languages.. – David Cowden Jun 30 '12 at 16:11
  • @Caleb That site exists because it's not well-defined - if English vocabulary was well-defined, a dictionary would be sufficient and the site would not exist. – Izkata Sep 06 '12 at 18:11
  • 1
    @Izkata Exactly. Ergo, the OP's premise that both English and computer languages have well-defined vocabularies is false. – Caleb Sep 06 '12 at 18:23

7 Answers7

18

The essential distinction, I would say, is formally-defined syntax and semantics.

A programming language can be parsed by an automated tool according to formal rules, and found to either have meaning according to those rules, or be invalid and therefore worthless. And if it does have meaning, it means exactly what the formal rules say it means and nothing else.

A human language, on the other hand, is not understood formally but intuitively. You can mutilate the grammar to a pretty high degree and the person you're talking to will still understand what you mean, and what you mean (and are understood to mean) is frequently not precisely what you said.

As a side note, this tends to make natural language extremely difficult to parse. It remains one of the great unsolved problems of artificial intelligence, despite being one of the ones they've been working on the longest!

Mason Wheeler
  • 82,789
  • how you can define the semantic of a pointer? The pointer are probably born just to bypass the "scope" which is a concept strictly related to semantics. – user827992 Jun 29 '12 at 23:55
  • 2
    @user827992: No, pointers are not "scopes", they are memory addresses. They have a well-defined meaning: a pointer to an integer (for example) is the memory address of a variable that contains an integer. Scoping is a completely unrelated concept. – Mason Wheeler Jun 30 '12 at 00:01
  • pointers are types, the content of a pointer is usually an address, they can also be NULL, from your point of view they are something like a bridge between a label and an address, it's not like that, a pointer, as third options, can also point to a random address for X reasons. Pointer are types and this does not ensure you that they have a meaning. – user827992 Jun 30 '12 at 00:06
  • Also - The semantics of a instance of a pointer is going to be relative to program that's running. – spinning_plate Jun 30 '12 at 00:13
  • 1
    Ahh - heres proof, we all (well, mostly all) intuatively "know" what a pointer is, but struggle to describe what it is in plain english. Yet the language definition means the compile knows exactly what it's for and what can and cannot be done wih it. – mattnz Jun 30 '12 at 00:39
  • @MasonWheeler AFAIK many programming languages do not possess "formally defined" semantics (as in www21.in.tum.de/~nipkow/pubs/Jinja/jinja.pdf by Klein and Nipkow). They usually have some implied semantics given through a compiler or interpreter. But that is very much like human language where humans act as interpreters. – scarfridge Jun 30 '12 at 11:26
  • 2
    @Scarfridge: The compiler is the formal definition. The language means exactly what the compiler says it means, and nothing else. Anything else--including a standards document written in a human language--is simply an attempt to describe the behavior of the compiler in an easier-to-read format. – Mason Wheeler Jun 30 '12 at 12:21
  • @MasonWheeler Giving the semantics for a programming language through a compiler is highly undesirable from a formal point of view. We want to be as precise and concise as possible. But your definition relies on the target language of the compiler thus it becomes part of the definition too. Additionally consider the language the compiler is written/executed in. Again, part of the definition. Now take bootstraping and any intermediate "definition" of the language becomes part of its definition. This is not in the same league as a definition in axiomatic or operational semantics. – scarfridge Jul 01 '12 at 16:50
4

Here's a biggie:

Mason has already said this, but: Formal languages have formally defined semantics. Human languages don't. It's not still really well understood how humans extract semantics despite the fact that this has been studied for decades by linguists, philosophers and psychologists.

I think it's pretty obvious that formal languages lack the semantic richness of even simple natural language. "The cat jumped over the lazy dog" encodes and is dependent on far more information about the world than just the definitions of the words and the syntax alone. Formal languages lack the syntactic and semantic ambiguity that is possible with natural language as well.

4

When I was a prof 30 years ago there would be these Faculty Colloquia or off-site weekends where some profs from around the university would get invited, with deans, for fancy food and "collegial" discussions. Read: b o r i n g.

Once the question was raised: Should a computer language be allowed as a substitute for the foreign language requirement?

This drove me nuts. To think that learning BASIC or PASCAL (at the time) was even on the chart, compared to learning French, German, or another human language and culture, seemed preposterous.

Technology is beautiful. It has a depth of meaning that can't really be imagined outside of it. At the same time, it is easy just to think of it as a means to an end - a way to engineer our mechanical slaves.

What is there in programming that can compare to a poem, or a novel? When you learn a human language, it is not just a vocabulary, syntax, etc. It is a window on history, culture, beauty, what makes life interesting.

Mike Dunlavey
  • 12,835
  • 3
    History, culture, and beauty? Their value is highly subjective at best. Computer programs can correspond to a poem or novel easily- they are also highly creative and, if you know where to look, beautiful. They even have dialects. Human languages involve pointless ambiguity, and can only express the kind of beauty that rarely gets anything done. – DeadMG Jun 30 '12 at 04:11
  • 3
  • 3
    "Human languages involve pointless ambiguity, and can only express the kind of beauty that rarely gets anything done." - This makes die a little inside – spinning_plate Jun 30 '12 at 07:24
  • 1
    @spinning_plate I feel with you – scarfridge Jun 30 '12 at 11:15
  • 1
    @DeadMG: Try reading Lacuna, The Death of Ivan Illych, Heart of Darkness, Mrs. Dalloway, or A Thousand Acres and show me a comparable program. Software does something for you. Literature does something to you. – Mike Dunlavey Jun 30 '12 at 13:37
2

"A programming language is only useful for a PC" isn't fair you're right.

Fair way to state the difference would be

A programming language is also useful for a PC

The point is, programming language (just like English) is primarily intended to be read / communicated by humans, but unlike English, it has a cumbersome limitation that it has to allow for machine execution.


...Writing code certainly feels very similar to writing poetry. When I'm writing poetry, it feels like the center of my thinking is in a particular place, and when I'm writing code the center of my thinking feels in the same kind of place. It's the same kind of concentration. So, I'm thinking up possibilities, I'm thinking about, well, so how do I reinvent the code, gee, you know, what's the simplest way to do this.

I'm thinking about things like simplicity -- how easy is it going to be for someone to look at it later? How well is it fulfilling the overall design that I have in mind? How well does it fit into the architecture? If I were writing a very long poem with many parts, I would be thinking, "Okay, how does this piece fit in with the other pieces? How is it part of the bigger picture?" When coding, I'm doing similar things, and if you look at the source code of extremely talented programmers, there's beauty in it. There's a lot of attention to compression, using the underlying programming language in a way that's easy to penetrate. Yes, writing code and writing poetry are similar...

         (Richard Gabriel, Janice J. Heiss, The Poetry of Programming)

...Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.

The practitioner of literate programming can be regarded as an essayist, whose main concern is with exposition and excellence of style. Such an author, with thesaurus in hand, chooses the names of variables carefully and explains what each variable means. He or she strives for a program that is comprehensible because its concepts have been introduced in an order that is best for human understanding...

         (Donald E. Knuth, Literate Programming)

gnat
  • 21,213
  • 29
  • 113
  • 291
  • I think that the Morse code can break the logic of your answer. – user827992 Jun 29 '12 at 23:57
  • I don't understand this. A programming language is a pretty cumbersome way to communicate anything except instructions to a machine. – spinning_plate Jun 30 '12 at 00:01
  • @spinning_plate really? I frequently do code reviews, and, believe it or not, I see quite a lot of a nicely readable code – gnat Jun 30 '12 at 00:05
  • 1
    @gnat - Example: write me a piece of code that communicates "Larry ate pizza". Printing "Larry ate pizza" doesn't count – spinning_plate Jun 30 '12 at 00:09
  • 2
    @user827992 Morse code is a transport mechanism tied to the Latin alphabet (usually). It doesn't convey any other information besides the text itself. Formally it is a binary code and the computer can 'peel off' the encoding part, not make sense of what is underneath it. – K.Steff Jun 30 '12 at 00:32
  • 1
    Person("Larry").ate(Food("Pizza") – Michael Best Jun 30 '12 at 00:44
  • @MichaelBest - Translated to English - "Some object named Person takes a string and performs an operation ate on some other Object food that takes a string of characters". My point is that 'Person' object has no semantic content the way the word "Person" does. – spinning_plate Jun 30 '12 at 03:12
  • @spinning_plate The word "Person" has semantic meaning because of the connections it has to other arbitrary concepts, which only have semantic meaning due to further connections to other arbitrary concepts... Exactly like how the "Person object" is defined by its relationship and interactions with other code in the theoretical system that snippet is from. – Izkata Jun 30 '12 at 07:02
  • @Izkata - I agree with the logic but I don't think it's exactly like that at all. Take a look at any word/concept from WordNet which has part/whole is-a relations and other semantic links. The example provided likely doesn't have near the complexity of this, but theoretically you could make classes or whatever your favorite language provides. This was essentially the project of AI 30 years ago and it failed. It ran (still does) into the Frame Problem and some philosophers have argued that this still doesn't have any semantic meaning. – spinning_plate Jun 30 '12 at 07:37
  • @spinning_plate The problem is that a pure reasoning approach bogs down completely before it gets to the scale where it can tackle the level of dataset necessary for AI. Clearly that's the wrong approach. (Pruning the concept space — and sticking to mainly parsimonious property definitions — would help a lot; the cost would be that some things would be missed, but getting tractability would be a win anyway. Especially if it meant that you could reanalyze a few seconds later if the input data changed.) – Donal Fellows Jun 30 '12 at 11:19
  • @DonalFellows - I agree and I think it's more than a complexity problem. The fact that the scientific community couldn't figure out the pruning part is indicative that might be approaching the problem wrong. The trend in the fluffier world of cogsci is to claim that semantics can't be disentangled from the agents environment. But then you have Google that can do some pretty fancy human tricks with statistics, so who knows... – spinning_plate Jun 30 '12 at 16:35
2

Ask a strange question and you get a strange answer :) Here are some differences (INMO)! enter image description here - Add to the list the fact that recursion is meaningful to computers only and not to humans.

NoChance
  • 12,462
  • 2
    What do you mean by "recursion is meaningful to computers only"? The Euclidean algorithm for GCD is recursive and it's been used by humans way before any form of computers existed. – K.Steff Jun 30 '12 at 01:28
  • 1
    Somebody is bound to take on the challenge of writing poetry in code, or worse starting a religion whose founding text is in COBOL ;) – Terence Johnson Jun 30 '12 at 01:48
  • 2
    So basically, you cherry-picked all the worthless things that you think are benefits for English, and listed them. – DeadMG Jun 30 '12 at 04:11
  • 1
    @K.Steff, you are correct, my wording was not accurate (it was 3 AM when I wrote this). – NoChance Jun 30 '12 at 06:26
  • 4
    Human languages don't have defined vocabularies. They have discovered vocabularies which are constantly changing. No one, not even a dictionary writer, defines what words exist in, say, English. Instead, they observe what words are being used in English at a point in time and record those. This is true of all non-invented languages. – Gort the Robot Jul 01 '12 at 00:53
  • @StevenBurnap, thank you for your comment, this is the first time I realize this. – NoChance Jul 01 '12 at 07:16
  • @StevenBurnap: I don't agree. Computer languages out of the box are just base languages. As soon as you use them, you add variables, classes, functions, etc., converting them into a specialized language for the particular need. – Mike Dunlavey Nov 18 '16 at 14:17
  • My point is that human languages aren't designed by anyone. They evolve through consensus usage, and there are never actually rules, just guideline. All computer languages, especially specialized ones, are deliberate rulesets where breaking a rule is a critical failure. – Gort the Robot Nov 18 '16 at 16:40
1

Purpose of any language is communication, to make your feelings known to other side be it a person or a machine. The basic difference between English language and programming language is the way of communicating the feelings. In programming language you do it in a way you do it with a child, giving parsed information while English is much more complicated than that. You need to make your thoughts understood as per the listener, but here you have a same set of instructions for the system. This is the basic point. Coming now to structure and composition- We use English in our programming languages but is not the other way around. Also neither the structure nor the composition is necessary in English but if you miss this in programs it computer will make your life hell till you correct it according to the predefined set of rules. It is why the programmers are trying to merge English into the Programming language that Artificial Intelligence was born; so as to merge the gap between English and Programming Languages, to make layman understand the machine and machine understand the layman.

gnat
  • 21,213
  • 29
  • 113
  • 291
Srijan
  • 11
  • 2
1

When you're speaking programming language you're speaking data and clear instructions.

When you're speaking English you're having 1 big negotiation over non-data which ends in ambiguous instructions and hidden meanings to data supposedly being clear.

Pieter B
  • 13,220