Mixing Programming Languages
So, weary and waiting for my wife to arrive at the Kalahari, I decided to take a nap to kill the time. I drifted off for a while easily but then awoke. Since the situation had not changed much in that half of an hour, I decided to try and sleep some more. As I started again, for no particular reason, I began to shuffle through some of the occurrences in Leo Tolstoy’s War and Peace that I have been trudging through for weeks now. What was hi-lighted in my mind were the frequent passages and phrases in this book, which in its entirety has been translated from Russian into English, that skip to French and German. The foreword to the book explains that these flips of language have been left intentionally by the translator because they were digressions from the original Russian that the book was authored in. This may seem odd, but not so much to me. I have a degree in English literature and I saw this technique used often. Not only is it useful to intermittently switch to French, German, Italian, Latin or some other language in literature, authors love to recreate dialects of languages. Some rare, inventive authors even make up their own languages (the most famous of which, to CodeMashers, will be J. R. R. Tolkein).
I moved in and out of sleep with this revelation in my mind: it is not world-changing, unusual, or even striking that an author of reputable literature would mix two languages together. I well know from my study of the English language that it is not perfect. And neither is German, Latin, Swahili, the Queen’s English or any other spoken language. Each language has an amount of nuances that borders innumerable that makes it expressive in ways different from all other languages. An author of good literature pays attention to every word that he produces. Every word must contribute meaningfully to the whole such that the whole is not complete or correct without that specific word. I won’t digress here, but picking that word is not just based on a definition, it is a decision made by considering definition, connotation, sense, length, look, context, and the author’s general attitude towards the word. What is important here is that this decision is important and must be made for every word in a work of literature. If no word in the main language of the work, say English, is just right, the author will look to another language. If it is a French word that is right, then the French word is used.
After I had analyzed this about the mix of languages in War and Peace I then had my revelation that there is absolutely nothing wrong with mixing programming languages together. Programming languages are no different than natural languages. Each programming language has nuances that make it expressive in ways that other languages cannot be. This leads to a perfect justification for intermingling programming languages. If, when building an application in one language, say Java, you become stuck as to how to express a certain step, you might find that inserting a line of Ruby will fix the problem. This is a wonderful realization. There should be no competition between languages because we should just accept that all languages (probably) are equal but different. Mixing them together is the only way to achieve the perfect language, no language can achieve this singularly.
This idea is what I think the CodeMash coordinators intended, although maybe not to this extreme. .NET and Java programmers do not have to work in isolation and should not. They should strive to understand each other’s ways to find that there is probably an inter-locking of strengths and weaknesses in both tool sets that, if not compatible with each other, at least teach one another lessons that make both better. After years of skepticism a little rest and a great conference cleared this up entirely for me. I hope that this brief writing has helped you as well.