Thread: More languages?
View Single Post
Old Dec 8th, 2005, 10:20 PM   #9
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5 grumpy will become famous soon enough
Quote:
Originally Posted by Arevos
Nevertheless, compared to natural languages, the differences between computer languages are not considerable. To be fluent in a natural language, you have to know something like 6000 words. To be fluent in a computer language, I'd be surprised if that number exceeds 50.
You are focusing only on syntax. Number of words known isn't the only measure of fluency in a natural language. There is also the semantics and grammar. It just happens that the process of learning a natural language happens to result in a student having a working knowledge of semantics and grammar at about the point where s/he has learnt 6000 words or so.

Programming languages are different, in that the basic syntax is often quite simple, but the grammar (what can go with what) and semantics (meanings of different combinations of constructs) are more complex, particularly with modern programming languages.
Quote:
Originally Posted by Arevos
Likewise, the syntax of a computer language is consistant and often consists of a relatively few rules. Compare this to the shifting inconsistancies of English!
You might want to check up on the history of C and C++. Those languages have changed a considerable amount since they were created. As an example, the C++ standard was in draft for ten years or so (during which several drafts were available, with substantial differences between versions) and compilers were implemented along the way. Hence it is possible to find some C++ compilers that won't compile code that is compliant with expectations of the standard.

Again, the issue is that you are focusing on syntax and ignoring fundamentals such as semantics (i.e. meaning of code constructs). I would agree it is quite easy to learn the basic syntax of languages like C++. A lot of the problems that novices (and even some experts) have with C++ (eg in forums like this one) are unrelated to the syntax. The bulk of problems come about because people attach meaning to some code constructs that is invalid.

Quote:
Originally Posted by Arevos
Further, the similarities between languages run deep. Once you know that an if statement executes a block of code on a condition, you need only learn the way this differs between languages. In Java, blocks are delimited by {}, conditions are surrounded by (), commands are delimited by ;. In Python, blocks are delimited by whitespace, control statments end in :, and commands are delimited by newlines. In just two sentences, a significant proportion of the differences between the languages are revealed.

You make a good point that programs are rarely this simple, but programs are often made up of simple parts. The syntax of computer languages tends to be rather concise and to the point; the complexity comes generally from libraries, and even the most experienced of programmers only bother learning the very most common libraries by heart.
The reason that similarities between syntaxes of programming languages appear to run deep is that those syntaxes are actually based on english, and hence readable to the native english speaker. For example, a construct "if (x = 1)" is actually readable (in a "big hands, small maps" kind of way) to someone who has a little knowledge of english. That is a property of the syntax of the language. But the actual meaning of that construct is where the differences between languages come in. For example, "if (x = 1)" has a markedly different effect in C than it does in Basic.
grumpy is offline   Reply With Quote