Over a million developers have joined DZone.

Sergey Dmitriev, JetBrains CEO on Language Oriented Programming and MPS

· Java Zone

What every Java engineer should know about microservices: Reactive Microservices Architecture.  Brought to you in partnership with Lightbend.

Sergey DmitrievI recently had the chance to bounce a few questions off Sergey Dmitriev, founder and CEO of JetBrains.  Since he is an active promoter of language-oriented programming, and he is the one who started the JetBrains Meta Programming System (MPS) project in 2003, I naturally asked him about these two areas.  Here is what he had to say.

 Aslam Khan: You introduced the idea of Language Oriented Programming and Language Workbenches a few years ago and have released the beta of MPS now. During this time, has it been pure research and product development or do you think that the community is now ready to take such ideas into the mainstream?

Sergey Dmitriev: When the MPS project was started it was indeed just a research prototype. It could work only with small, ‘toy’ programs. As development progressed, we were able to work with larger and more real-world programs, and we have finally reached a state when we developed a whole new product with MPS – this new tool is due for public release in Q2-2009.

With this rich experience behind, we believe that the development community should be ready to start adopting our ideas. As for the mainstream, any migration to a new programming paradigm takes much time. For example, mass migration from structural to object-oriented programming lasted for more than 20 years. So, we do not expect any immediate coverage, but progressively-minded people can already start implementing this new approach to programming as we have supplied them with a powerful tool.

Khan:  In the last year, we have been hearing a lot about DSLs and how it brings code closer to requirements. With MPS, you have created a tool for creating DSLs, as I understand it.  Why do you think it's necessary to have a tool for creating DSLs? (note: if you feel that my understanding is incorrect, then explain what's the difference between DSLs and language oriented programming)

Dmitriev:  MPS allows more than just creating DSLs. It lets you create intelligent editors for them, with such benefits as code completion, error-highlighting, code analysis, refactorings and other important features. With DSL editors defined in MPS, domain experts will experience a fast learning curve, produce error-free programs and generally work in a more productive fashion.

Moreover, MPS in not only a tool for DSLs. Using MPS’s own base language (which is a universal Java-like language), you can write any kind of programs. You can also extend the base language as you like and embed new constructs into your program. For example, SQL is supported in Java through JDBC, but SQL statements are represented as String literals. With MPS, you can easily add the possibility to embed SQL statements into your code as first-class citizens.

Khan: ne of the issues with DSLs is that not many people are maintaining DSLs yet. How does MPS aid in maintenance of your new languages and the generated code emitted by MPS?

Dmitriev:  When someone creates a new language, they usually need to extend its syntax as new requirements appear, and this leads to changing the existing code. This is not a trivial task when you deal with text-based languages, since any modification to a language would involve modifications in its parser.  With MPS, maintaining a language is simply not a problem. Extending language syntax is transparent for the user. Also, for modifications of existing syntax we support creating ‘migration scripts’ which allow changing models automatically as the language syntax evolves.

Khan:  What do you think are the barriers for entry to the world of meta programming, and how does MPS help in this regard?

Dmitriev:  With MPS, the concepts of creating a language are much easier to understand, compared with the knowledge required to create a parser, for example.  Any developer who is capable of creating and maintaining a moderate-size project should be able to create a language in MPS. Actually, our own experience shows that an average 3rd-grade university student is able to start using MPS efficiently after playing with it for one week.

Khan:  The MPS generator plays really nice with generated Java code. Can we expect similarly close support for other languages like J/Ruby?

Dmitriev: MPS can generate almost any language if text generation code is provided. In beta release, we have support for Java and XML, but it does not restrict users from adding their own generators for other existing languages. We will be also adding support for other generators in the future.

Khan:  Most DSL experimenters start with a dynamic language for creating DSLs, using "eval()" and/or meta object protocols to implement the DSL. Also, syntactic sugar and other line noise reducing language features become quite important for these internal DSLs (as Martin Fowler calls them). Why did you decide to focus on external DSLs and implementation in a statically typed language such as Java?

Dmitriev:  "eval()" and meta object protocols are indeed good for experimenting. But when you want to provide quality IDE support such as code navigation, finding usages, automated refactorings, etc., these things are much easier to implement in a statically typed language.  And we are not only focusing on external DSLs. Internal DSLs are also supported. A major feature of MPS is language extension. MPS allows adding new constructs to base language and using them similarly to how it’s done in Ruby and other internal DSLs, but with type system, navigation and other things that we are used to in modern intelligent IDEs such as IntelliJ IDEA.

Khan: What can we expect in the future releases of MPS?

Dmitriev:  We cannot be too specific right now. The goal of this Beta is to gather as much feedback as possible, in order to better understand the needs of current and potential MPS users. This will help us map out our further efforts.  What we already have in development, to appear in the nearest future, are a couple of new languages, such as a language for defining UI, a language for more concise language definition, and so on.

Khan:  When can we expect more from MPS?

Dmitriev:  We have just release MPS Beta-2 in March 2009, and the official release of version 1.0 can be expected in Q2 2009. So stay tuned!

Microservices for Java, explained. Revitalize your legacy systems (and your career) with Reactive Microservices Architecture, a free O'Reilly book. Brought to you in partnership with Lightbend.


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}