"Language Oriented Programming" Meta Programming System

(I'm not affiliated with them in any way.)

The Meta Programming System from JetBrains:

"MPS is an implementation of Language Oriented Programming, whose goal is to make defining languages as natural and easy as defining classes and methods is today. The purpose is to "raise the level of abstraction", which has been a major goal of programming since the first assembly language was born. MPS uses a variety of techniques, especially generative programming, to achieve this. With the freedom to program at a higher level, programmers can increase productivity, reduce errors, and adapt to changes more quickly.

The MPS project is still currently in the research phase, and could benefit greatly from open review and comments from anyone interested."

I dunno if this is snake-oil, but I've heard good things about the other tools they have released (IntelliJ, Resharper).

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

already discussed

Now I notice the already existing discussion even though I had used the search - should have just read the front page instead. :-)

Revolution next door

Reflections of the author Sergey Dmitriev:

It is time to begin the next technology revolution in software development, and the shape of this revolution is becoming more and more clear. The next programming paradigm is nearly upon us. It is not yet fully formed different parts have different names: Intentional programming, MDA, generative programming, etc. I suggest uniting all of these new approaches under one name, language-oriented programming, and this article explains the main principles of this new programming paradigm.

Last but not least the paradigm shifter Sergey has already created MPS the living solution. What do you think? Wouldn't he be a fine candidate for the Turing Award? I guess he would be less annoyed by fame than Grisha Perelman.

it seems...

It seems like it would be easier to simply use a language which has sufficient abstraction capabilities built-in. I wonder what he thinks functions are for.

Friendly surface syntax

Friendly surface syntax shall enable programmers identify entities quickly and hide boilerplate. But Fowlers MPS demo language does not appear to fit the same niche as general purpose languages but more Web forms and such alike. So it competes with better situated and also more user friendly technologies. No wonder that both the intentional programming system as well as MPS are created by user interface designers who address their solution to an imaginary user group: the programming non-programmer. This ephemere P and Non-P being might exist in the realm of Excel but I can't really say it is a giant leap for the mankind to replace VBA by an even simpler language tried at home. On the other hand I might rethink my reservation against MPS in the presence of XML scripting languages for Java! *shudder*

Ah, that makes sense.

Ah, that makes sense.

User interface designer?!?!?

I'd hardly call Sergey a UI designer. Jetbrains produce the best development tools by far. They are *much* more than a pretty UI for text editing. They are finally helping the mainstream understand that programming is about creating relationships, not arranging text.

You could take it one stepp

You could take it one stepp further and say that it would be even more simpler with a language which has sufficient functionality built-in. Instead of forcing the programer to make his/her own functions.

One Language Syntax Not Enough

Even if you used a language like Lisp instead of a language like Java, this still wouldn't be enough. Yes you would have macros, code-as-data, support for higher abstractions, etc., but only in your main language. The type of systems which benefit the most from Language Oriented Programming involve several tiers, technologies, and languages. What you really need is a way to encode your intent only once in such a way that it could be used to generate/represent not only your main programming language code, but also your HTML, CSS, Javascript, Corba IDL, WSDL, SQL, stored procedures, etc. Also it would be good if you could also generate some of your on-line and off-line documentation with the same process. A single language solution is only suitable for single language problems.

one language not enough

Often I end up making little languages interpreted by another language or generated by a particular language, any higher level tool for managing these languages needs to take this into account. I am not sure what such a tool would look like, but I know it isn't what I saw with the meta programming system.

Maybe less like an editor and more like an OS.

So the compiler must be a scripting language.

...and I agree with that: the source code must not be a passive document, but something that is executed at compile time, i.e. a scripting programming language. For example, with this language, one would be able to:

1) create the database or modify it to fit the latest information model.
2) check queries at compile-time.
3) create the necessary documentation.
4) create the html code for the interface.
5) create the server code.

So a single language solution is possible, provided that it is structured correctly.

Already Discussed (Twice)

In addition to the above "already discussed", it was also already discussed here.

BTW This is the same thing that Microsoft called Intentional Programming when they were working on it. Charles Simonyi has since left Microsoft and started a new company called Intential Software.

Didn't Douglas Engelbart already do this in the 60's?

While watching video of Douglas Englebart's famous 1968 demo of his NLS system, I noticed him showing something that he called "special languages" or "special purposes languages". It appears that he had lots of small languages for many different purposes, and that the environment provided structured editors for them.

Does anyone know enough about NLS to say whether or not "Language Oriented Programming" just the same thing? Are JetBrains and Microsoft just the latest in a long line of re-inventors of Englebart's work?

I prefer a mathematical solution to correctness...

...over freedom to make new domain-specific programming languages to solve a particular problem.

The problem of software is not the freedom of expression, because languages exist where abstraction levels can be very high, right down to reducing the implementation to a declarative style. The problem of software lies in correctness, and most importantly how to keep invariants from being violated.

That's rather sweeping

I can think of a whole host of things that many languages express awkwardly. Try coding "if condition iterate forwards through array else iterate backwards," without reversing the array (easy -- and expensive -- cheat in list languages). Is the increase in logic errors on programmers' part due to obfuscated code due to inexpressive languages insignificant?

A DSL does not mean code is not obfuscated.

Obfuscated code means something different for different people. For example, you make a very good DSL to solve a particular problem, but when I get hold of it, I am lost, because my way of thinking is different than yours (or I even speak a different language).

But if there was a way to declare invariants and have the compiler check them at compile time, then no matter how bad a programmer I am, the propability of an error would be very close to 0.

syntax doesn't care

The problem with DSL's is that one has to learn a new language each time.
Perl may be better at string processing and APL at matrix calculus, it doesn't help if you're not comfortable with them. It's often more productive for you to program in a language you master, than in a language fitted to the domain but for which you're still in the middle of the learning curve.
Syntax doesn't care if one makes the effort to get used with it. Lisp, Forth, APL programmers will tell you that the syntatic peculiarities of their languages is not a problem. Syntax has little impact on productivity compared to the programmer's skill, the availability of librairies and feature support (exceptions, parallelism, etc.) among other things.

The "paradigm shift" is > 30 yrs old ...

From a cursory read of Sergei's paper, I find his description of why we should write DSLs to solve problems rather simplistic. In my minimal experience, DSLs are worth creating only to solve a sufficiently broad class of problems. They aren't worth the learning/design trouble otherwise.

He also says that one is "limited" by the syntax of the host language for "internal DSLs". There is no harm in tailoring your syntax to match that of your host language. This avoids more documentation and maintenance headaches. In lisp, for ex, you can often break up your intended syntax into a sequence of sexpressions and process them using lisp macros. In cases where parentheses scare spreads, its possible to write alternative syntaxes that map to lisp once.

I must say that detecting the need for a DSL in a domain and solving a good subset of the problems in the domain by writing a general solver for the DSL is one of the most rewarding programmming tasks :)


I kind of had the same feeling as you: There isn't much in there which isn't mostly solved by Lisp already. One may like or dislike the surface syntax of Lisp, but with the aid of hygienic macros creating DSLs is easy as pie, and your IDE/editor will even be able to understand the basic syntax of your DSL to some degree -- at the very least to the degree where you can do syntactic refactoring very easily. If you don't want your DSL to have a Lispy syntax you could always put another surface syntax on it (as you mentioned).

If you want your IDE to understand more of the DSL's syntax beyond the syntactic elements you could always create a plug-in for your IDE. The IDEPlugin interface might be worth standardizing though I'm pretty skeptical as to whether that's (politically and practially) possible.

Re: IDEs

Ignoring the fact that it is often said on LtU that syntax is easy & semantics difficult... I'll wonder aloud if it would be useful/possible to dream of a "wizard" that would generate a DSL template for you after asking questions like "what kind of base syntax do you desire: 1) s-exprs 2) c-style block imperative structure [etc.]"? If it asked enough questions it could perhaps generate an IDE plug-in for the syntax which might be nice. Ideally it would generate a parser etc., and work in a very iterative fashion to let you refine your semantics.

DSLs are extremely cool if they are used at the right time in the right place and are designed well; lowering the barrier of entry to them might be beneficial to the software engineering world in general. (At least people could more easily try out a DSL and dis/prove that it is the way to go for a given issue.)


I'll wonder aloud if it would be useful/possible to dream of a "wizard" that would generate a DSL template for you after asking questions like "what kind of base syntax do you desire: 1) s-exprs 2) c-style block imperative structure [etc.]"?

I guess it's not done because the user would be too frustrated about his own decisions. If there is no one he could finally blame but just himself he is forced to commit suicide ( or less melodramatically: stop being a user ). The last thing people do want is making contingent decisions nonstop. The last thing people do have is an educated taste. Only misguided designers wishes systems that burden decisions to others while being themselves the masters of wishes just like a good fairy. The other extreme are designers who are a bit anal and want to do decide everything on their own.

For further reading I recommend Jef Raskins notes about modality in design.

And of course I recommend "U-Write-It" in A perfect Vacuum by Stanislav Lem.