The trend seems to be clear; in the next few years there will an increase in adoption of new programming languages. Not primarily to replace the ones we currently use, but to mix languages and use the right language for the problem.
But what is the right language for a particular problem? In a recent blog post, JRuby developer Ola Bini dives into the topic from a new angle. Multi-lingual programming, also known as polyglot programming, has been covered earlier by InfoQ, but Bini describes the phenomenon in the context of how we may build future systems; which types of languages we may use - and for what.
Bini describes three different layers and the languages, or rather language types, that fits into these layers. No, not the classical presentation, business, and data layers; Bini slices the world differently:
- a stable layer - not much application functionality, built with static languages
- a dynamic layer - a lot of application functionality, built with dynamic languages
- a domain layer - a lot of application functionality, built with domain specific languages
Bini describes the stable layer:
The first layer is what I called the stable layer. It’s not a very large part of the application in terms of functionality. But it’s the part that everything else builds on top off, and is as such a very important part of it. This layer is the layer where static type safety will really help.
The dynamic layer is where most of the application functionality exists:
The second layer is the dynamic layer. This is where maybe half the application code resides. The language types here are predominantly dynamic, strongly typed languages […]
Also considering the dynamic layer, he adds:
It’s a nice and productive place to be, and obviously, with my fascination for JVM languages, I believe that it’s the interplay between this layer and the stable layer that is really powerful.
In the domain layer, Bini bets on the emergent DSL movement.
The third layer is the domain layer. It should be implemented in DSL’s, one or many depending on the needs of the system. In most cases it’s probably enough to implement it as an internal DSL within the dynamic layer, and in those cases the second and third layer are not as easily distinguishable. But in some cases it’s warranted to have an external DSL that can be interacted with. A typical example might be something like a rules engine (like Drools).
David N. Welton wrote a response to Bini’s post, where he describes his doubts about this evolution:
I’m dubious, and wonder what he would consider to be the underlying sociological and economic factors driving this change. Programming languages are, in the end, about people in all their weirdness, so to understand where languages are going to go, you have to consider those human factors […]
Welton refers to an article he wrote a couple of years ago that analyzes the economics of programming languages. In the article, Welton finds that since most language implementations are free today, the only way to get better economics using a new language is if it makes the code:
- easier to write - more people can use it
- more efficient - saving resources
- higher quality - less bug fixing
- more productive - lets you do complex things easily
Ola Bini wraps up by explaining that he does not believe in the next big language, even within one layer:
But I need to make one thing clear - I don’t believe there will be a winner at any of these layers. In fact, I think it would be a clearly bad thing if any one language won at any layer. That means, I’m seeing a future where we have Jython and JRuby and Rhino and several other languages coexisting at the same layer. There doesn’t need to be any rivalry or language wars.
Bini has done big contributions to make mixing languages on virtual machine level possible by his work on JRuby, and many other have done the same for other languages. On the other big virtual machine platform, Microsoft prepared for multiple languages from the start by providing VB.NET, C# and C++ implementations for the Common Language Runtime. Recently, they also released the Dynamic Language Runtime, on top of which IronPython and IronRuby is built, which emphasizes that .NET is a multi-language platform.
But the article still leaves interesting questions:
- Is Ola Bini’s view of different layers and languages the way the future will play out?
- What are the pros and cons of mixing languages within one virtual machine?
- Are other potential ways of mixing languages a better choice? (Examples could be service oriented applications where each service is implemented in the most suitable language, or in the case of a restful web application; slice it vertically into many small applications at url level.)
In short, how will future systems utilize programming languages?