Tuesday, November 30, 2004

Language Oriented Programming (Pt 2)

In a comment to my last post, Rob Harwood (from JetBrains) pointed out a great article by JetBrains Co-founder and CEO Sergey Dmitriev on Language Oriented Programming. In it he goes in to a good deal of detail about their latest product/experiment: The Meta Programming System (MPS).

The article is very interesting. It provides a high level breakdown of each part of MPS and promises many more details in the future. I think the article is a bit more complicated than it needed to be. As an example, Dmitriev shows us how to construct MPS using MPS (not exactly �Hello World�). Overall, I think he gets his points across well. Those parts requiring more detail usually promise future articles on the subject (which I am definitely looking forward to).

There were quite a few concepts that I wasn�t really expecting. The first was that the languages created in MPS will be able to easily take advantage of advanced editor features such as refactoring, code completion and syntax highlighting. This could be really powerful. A language specific to my area of business may have IDE features more powerful than many well-established languages.

I also liked that the languages can generate code for any number of general-purpose languages (Java, C#, C++, etc.), or they could generate code into another MPS language. Because of that, languages can build upon each other. My accounting language might compile down into the MPS base language (which defines common language constructs, like jstl�s core library does for JSPs). The base language knows how to compile down to a dozen general-purpose languages. In effect, my accounting language supports a dozen programming platforms for free.

I also like that these are languages rather than libraries. It allows them to offer all the features that C++ promised (model the language after your domain) without all the mess, and hopefully requiring much less discipline.

I still have questions about Domain Languages in general. One thing I wonder about, is how this will effect separation of duties if it were to take off. Assuming companies write their own languages, would some programmers write domain languages, while others use them? Could languages be reused effectively, or will every company end up with their own?

I�m still not entirely convinced that creating a domain language can be easy (I don�t know if I�ll be a believer until I try it myself). I am looking forward to reading more about it.


Wednesday, November 10, 2004

Language Oriented Programming

Jetbrains (maker of IntelliJ IDEA) is working on a new project internally referred to as MPS (Meta Programming System), which looks very interesting. It�s based on a concept called Language Oriented Programming. Essentially, they want to make it easy to create domain specific �languages� allowing programs to be written at a higher level. In this case a language could be visual (like UML) or textual. It might be structural or declarative. Its only important that the language suits the domain. Each language would be closely tied to an editor used to manipulate the language. This domain level language would eventually be used to generate a lower level language (like Java or C#). This allows the domain specific languages to interact via the lower level languages.

In college, I was always told the next evolution in programming languages would come from natural languages. One day I would just sit down and explain in plain English what I wanted the computer to do, and it would just do it. Of course even the teacher was smiling at this point. Most business problems are hard to explain to other people without first defining 20 terms, creating a lexicon of shapes and filling a white board at least a couple times. I couldn�t imagine trying to spell out the logic in English so a human could understand it, much less a computer.

Imagine, however if the language had already defined most of your terms. Imagine a language built specifically for authoring point of sale applications. It already knows a set number of terms. It has its own editor with pre-defined flowcharting widgets, and it generates code that would be compatible with your existing Java system.

Of course creating a new language just for my problem domain is currently out of the question. In the time it would take, to write the language, I could have created the system that I wanted it to generate. That�s where MPS comes in� a framework for writing domain specific languages. It seems like a lot to ask for. I wish them luck.

For more info, check out this interview at Code Generation Network.