The idea of a hybrid language
I came up with the term hybrid language for languages that let you build the client and server sides of an application using the same dialect. I use the word dialect deliberately, because in this context the language goes well beyond what we normally mean by the word. To me, a hybrid language consists of a dialect that describes how the program behaves and a compiler or interpreter that adapts it to a particular runtime environment, whether that is a server, a mobile phone, a tablet or a web browser. The future of development may belong to one of the hybrid languages being built now or yet to come. Why might the future belong to hybrid languages? Look at the emerging languages for developing multitier applications and you will see that using the same dialect on the client and the server is central to the effort. The rise of mobile devices is speeding that effort along. It is hardly a simple task. The designers of hybrid languages face several major obstacles.
We don't program in a vacuum
The code we write and design makes specific assumptions about the runtime environment. Suppose you have code written in Java and a hybrid language that uses Java as its dialect. You should be able to move that code between server and client. Differences between devices and restrictions in their runtimes make that harder than it sounds. Concurrent access is the first problem. Code written in a client environment will probably be ill prepared to run in a highly concurrent server environment. The hybrid language, presumably through its runtime, would have to ensure safe execution in the face of race conditions.
We need to take the resources of the target device into account just as we do the context in which the program runs. Swing was a cautionary example. One reason it failed was that it never looked or behaved like a native application. A hybrid language will need a well-designed interface for accessing native functions. At least to start with, the same interface should also let developers use existing libraries. Integration with libraries that provide graphical user interfaces will be crucial.
A dynamic mix
For a long time I thought JavaScript would be that hybrid language. More and more signs point me away from that conclusion. The main shortcoming is code maintainability, and I worry that applies to any dynamic language. JavaScript could still provide the right runtime environment for compiling or interpreting a hybrid language. That makes me think the hybrid language's dialect should have features of both dynamic and statically typed languages. A dynamic approach is much better suited to working with data. Incidentally, that's an area where statically typed languages fall short, as the pitfalls of mapping between data representations such as XML, JSON and RDBMS and their object representations illustrate.
From the bottom up
A hybrid language will probably be created for an entirely different purpose and adopted almost by accident. It may already exist and have escaped our attention. It reminds me a little of how Java came about and spread. It was originally designed for interactive control of consumer electronics and rode the wave of the internet much later. I doubt anyone can show up, announce a hybrid language and turn it into the industry standard. Today’s landscape of browsers, devices and server technologies is too fragmented for that. It is more likely to happen through gradual evolution. I have my doubts that one of the software giants, Google, Microsoft, Oracle or IBM, will push such a technology through, though I wouldn't rule it out. They are tied up with one another in patent disputes, preconceptions and legal battles. Google's Dart language illustrates the clinch, to use a boxing term. Those companies will naturally ride the wave of hybrid languages and contribute to it.
Alternatives
Are there alternatives to a hybrid language? Yes, provided the current fragmentation of development goes no further. We might then see existing technologies transform only partially. That evolution has limits, which we could soon hit as endpoint devices and clients become increasingly fragmented.
Conclusion
I have tried to summarize some of the ideas that make me think a hybrid language will emerge or already has. I have also tried to describe the conditions under which it might arise and what its basic characteristics might be. Please take this as a thought experiment based on what we know today.
Related articles
Related CZ Podcast episodes
- #3 · Java 6 SE, Vývoj webových aplikací
Dagi and Filemon discuss Java 6 and web application frameworks. · Czech audio
- #1 · Vývojová prostředí v Javě
The first CZ Podcast episode looks at Java development environments. · Czech audio