Wednesday, December 12, 2007

A theory on Languages!

Last evening, I was having a light hearted discussion with a cousin about Java, the programming language and I was trying to explain to him about the several Java based technologies. Since he is not from a scientific background, I was explaining to him what a programming language is using one of my analogies I had built based on languages in general. I do not claim ingenuity for what I am writing in the next paragraph. This is a simple analogy I have observed so far between programming languages and the common languages we speak in general.


We all know that any programming language has 2 broad components - specifications and implementations. Specifications consist of programming constructs (for eg. public, private etc in Java) and programming rules (order of usage like in Java we cannot write "static void public main(String s[ ])"). Implementations of the software languages are their respective compilers, class files (JVMs, .java files etc in Java). If we look at any of the spoken languages we have a similar scenario. Let us consider English for our discussion, though the analogy holds good for any other spoken language like German or Italian as well. In English we have constructs which we term as vocabulary or words in general. We have grammar rules for constructing sentences as well, but in contrast to software languages, spoken languages have an exhaustive set of grammar rules (to form accusative, nominative, affirmative, negative sentences for example). Poetry, Essays, Letters, Speeches, Ballads etc. (even Blogs ;)) could be considered as implementations of English language. Its my personal opinion, (not entitled to be completely true), that some of our spoken languages are better suited some specific tasks while some others are better for some other tasks. Based on the basic knowledge of the few languages I know, I find English to be ideal for technical parlance, Urdu is matchless for any pleasant (read as poetic or romantic) conversation with your loved one. Whenever I hear Hindi, images of an Indian politician addressing a crowd flash in my mind, while I feel Italian or Latin is good for composing Operas. On the similar lines, various programming languages are better suited for various domains. While some languages are better suited for web application development, some other languages are better suited for developing real-time applications. Well the only difference I observe between the two is the dialect factor. While dialects for a particular language differ from place to place, the coding standards for a particular programming language remain the same universally!