Even more than Polyglot programming.
I recently attended the second installment of the CodeMash conference in Sandusky, Ohio where one of the three great key note speakers was Neal Ford. Neal introduced the audience to the notion of Polyglot Programming. Polyglot Programming is just a phrase for something that we all do sometimes, but don’t always realize we are doing it; programming in more than one language within the same context.
After hearing Neal’s speech it occurred to me that the separation of languages we force ourselves to do is really unnatural. Writers don’t do this with the written language because it is too restrictive. Historians and journalists will often freely mix philosophic prose with cold hard statistical facts for example. And, even more compelling, the best writers of literature will weave phrases of a foreign language poetically into their works for greater effect.
Although there are many more, my best example right now is the book War and Peace by Leo Tolstoy. In War and Peace Tolstoy frequently inserts words and phrases from French and German. This tactic is not the device of arrogance or pedantic, but an effort at being as expressive and effective in language as possible.
Tolstoy mixed languages because he understood that sometimes a language can express something more effectively, expressively, succinctly, etc… than other languages. And Tolstoy was not the only author to mix languages. Mixing languages that way is just another literary tool that a good author will use if necessary. To enrich this point consider that Tolstoy wrote War and Peace in Russian, with the mixed in French and German. I don’t know any Russian, so I read the version translated into English. Despite the translation of the Russian into English, the phrases that Tolstoy inserted from languages other than Russian were not translated to English! That’s important because it signals a definite importance for those pieces of the text.
I think there is tons more to chase after in this topic. We are not at the point in Software Engineering where we can so easily mix Ruby and Lisp and HTML like Tolstoy mixed Russian and French and German, but, we’re moving in that direction. The plethora of languages that now run on the JVM is a good start and I hope that trend continues.