Language Oriented Programming: The Next Programming Paradigm
To understand what Language Oriented Programming is, let's first take a look at today's mainstream programming. It goes something like this:
Think:You have a task to program, so you form a conceptual model in your head about how to solve the problem.
Choose: You choose some general-purpose language (such as Java or C++) for writing the solution.
Program: You write the solution by performing a difficult mapping of your conceptual model into the programming language.
The Program step is the bottleneck because the mapping is not easy or natural in most cases (see Figure 1). This method has proved ineffective for programmers to express complex programs. In contrast, here is how LOP would work:
Think: You have a task to program, so you form a conceptual model in your head about how to solve the problem.
Choose: You choose some specialized DSLs for writing the solution.
Create: If there are no appropriate DSLs for your problem, then you create ones that fit your problem.
Program: You write the solution by performing a relatively straightforward mapping of your conceptual model into the DSLs.
Now, the Program step is much less of a bottleneck because the DSLs make it much easier to translate the problem into something the computer can understand (See Figure 2). It may appear that the difficulty has simply shifted to the Create step. However, a combination of tool support and applying LOP to itself will make this step much easier.
The motivation behind LOP goes something like this: I want to be able to work in terms of the concepts and notions of the problem I am trying to solve, instead of being forced to translate my ideas into the notions that a general-purpose language is able to understand (e.g. classes, methods, loops, conditionals, etc.). To achieve this, I need to use domain-specific languages. How do I get them? I create them.
I have begun development of a universal platform (the Meta Programming System) for designing domain-specific languages along with their supporting tools and environments. It will allow programmers to define languages as easily as they can write programs today. The platform will fully support LOP, giving programmers the freedom to use the most suitable language for each part of their programs, rather than tying them down to one fixed general-purpose programming language.
MPS is just one example of Language Oriented Programming. Although I will use MPS as an example, LOP could be achieved in many different ways. You might know of some alternatives yourself. The concept of LOP is not the same as its implementation, just as the concept of OOP is not the same as Java or C++ or Smalltalk.
What Is Wrong with Mainstream Programming
You know the old saying, "If it ain't broke, don't fix it". Mainstream programming is definitely broken. I see many problems with it, and most of them stem from the fact that there is no way for a general-purpose language to fully support arbitrary domains, and likewise there can be no universal domain-specific language. Here are the three worst problems with mainstream programming that will be solved by LOP:
Time Delay to Implement Ideas
For me, the most serious problem is that there is a very long gap between when I know exactly how to solve a problem and when I have successfully communicated this solution to the computer as a program. I can explain the problem and solution to another programmer in a matter of hours, but encoding this solution into the computer takes much longer. This is because with a programmer I can use natural language which is very rich, but for the computer, I must use a general-purpose programming language which is much less expressive. Programming languages today have only tens of notions that can be expressed. A natural language has tens of thousands of notions which can be expressed succinctly. So, to explain a program to another programmer, I can just express very high-level ideas, but for the computer, I must express every single step and every detail. In mainstream programming, most of the time spent 'programming' is really just finding ways to express natural language concepts in terms of programming level abstractions, which is difficult, not very creative, and more or less a waste of time.
For example, today a good deal of development time is spent on object-oriented design (OOD). This is actually a fairly creative process where the programmer expresses classes, hierarchies, relationships, and such. The purpose of this exercise is to express the program in object-oriented terms such as classes and methods. The process of OOD is necessary because these classes and methods are the only abstractions that object-oriented languages understand. It seems like it is necessary and creative, but with Language Oriented Programming, OOD is not needed at all.