It is already some years that I am thinking about possible evolution of programming that give away text as a form to store the programs or at least try to put more and more distance between the way the code is stored and the way the code is edited and explored. That extra mile can be done by the IDE, which makes you operate like you were manipulate the AST; this is the case of many refactoring operations.
During the years tools like Jetbrain’s MPS evolved and I also had the opportunity to work for some months on a project based on MPS, mbeddr. By the way me and others just started a community of MPS users, in case you are interested.
Recently I also read some discussions about the topic, like this one.
So I am thinking about the information produced by developers and possibly other stakeholders to be saved in some form, not directly resembling the form used to edit it. I imagine it as a sort of inter-related megamodel. I did some work on language interactions (empirical stuff, language integration in MPS, classification of interactions) and I think they are problematic, therefore we need to represent, visualize and enforce them. So I imagine a future where artifacts written in different languages are explicitly inter-related, and not just implicitly as it is now.
In this I got influenced by rails, as I said in a previous post.
I liked very much the idea that certain things can be specified from the command line: in rails you can add things to the model with some commands.
I would like to have many ways to specify things: the developer could insert information navigating in complex structure and putting the bit of info there (hence open the right file, scroll it and place your construct/field/specification) but also to use something similar to a command line, where to specify commands which were placed in the right place in the underlying megamodel. In the second case the disadvantage is that you have to specify the context (to use qualified names for example), the advantage is that you have not to navigate and to search in a complex project to find the right place where to type.
I imagine also that could be possible to query the megamodel or use wildcards while inserting info. And this leads to the next point: metaprogramming.
It could be possible also to refactor your code or specify constraints both from a command line and in some models.
For example you could specify commands to:
- rename all the abstract classes to start with “Abstract”
- replace all the “for (Iterator<X> it=it.iterator();it.hasNext();)” with “for (X x : it)”
But also query your codebase:
- give me all the classes with more than 10 methods
- give me all java classes which contains only getters and setters
It could be also possible to express constraints; either language rules or company/project specific guidelines. Or to collect metrics: all by running queries against the megamodel.
Your input could be checked and inferred all the time. Code generation is one kind of sloppy inference: from some input some output is generated. With inference it could be:
- multi directed: if I say that for every model a view should exist either I create a model or a view, the counterpart would be automatically added
- customization: in code generation I have to use protected regions or complex mechanisms, in my dreams I would just override nodes, the mechanism would save the delta. From input, inference rules and the delta the resulting system would be obtained.
In general the system should know which nodes are there because of inference and which nodes are actually inserted by the developer.
Depending on the context I would like to look at the system in different ways (example HTML code or rendered page).
I could also specify example parameters for template and render them to see an example. In that case a specific projection would have extra parameters saved.
Maybe the megamodel could be stored in a graph database.
Each node (a statement, a construct, whatever) should have its own identity and therefore being referentiable.
(Lack of) conclusions
This is maybe the end of my rants about programming, maybe I am just on a dead end or maybe I will not put my hands on such tools anytime soon.
Or maybe someone will leave a comment, we will start a discussion and some day…
You know, many years ago, when I read about Intentional Programming and I found out about first versions of MPS I would have not dared to dream I was going to use it in a real project, someday. Sometimes things happen.