29 October 2008

Polyglot Programming

I have been reading and thinking a while about Polyglot Programming. Polyglot programming means using multiple programming languages in an application or project. Now that Microsoft has introduced the DLR and is improving tool support, implementing polyglot programming on a single platform (.Net) is becoming easier. Using the right tool for the right job, the rationale for polyglot programming, is getting possible without a proliferation of operating systems, IDE's and other supporting tools.

The promised advantages of polyglot programming are compelling: greater productivity and better maintainability. Productivity will increase, because you are no longer restrained by the restrictions of one language. Some problems are easier and faster to solve using a different language. A consequence is that maintainability also increases: easier solutions are easier to maintain.
One of the disadvantages of polyglot programming is tool support, or the lack thereof. Microsoft's efforts to create one IDE for developing in different languages is trying to tackle this problem. Visual Studio 2010 and the .NET Framework 4.0 allow developers to use static and dynamic languages in their .NET projects and make it easier to create (internal) DSL's.
Another disadvantage is the need for knowledgeable personnel. Knowing when and how to use a language is imperative for the success of a polyglot programmer. Learning these languages can be hard and asks for the willingness to learn. Some even think you should learn a new language every year, though this is not always practically possible.

So, in a business sense, is there value in promoting polyglot programming in you organization? There is not much scientific evidence of an increased performance through increased productivity and maintainability by using polyglot programming. There is one exception: a case study (via Ola Bini) by Hans-Christian Fjeldberg found that productivity and maintainability increased. He also found that the knowledge disadvantage was not perceived by developers themselves, but was by management. He suggests that organizations restrict the language choice to a few options, like Google seems to do. I suggest using one platform, preferably .NET, that supports multiple languages. Being able to use the same tools for different languages makes it a little easier to learn and use a new language.