related_work.tex 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. \chapter{Related work}
  2. Our specification builds on the work from several topics.
  3. We identify the following topics: self-describable environments, action languages, and (meta-)modelling tools.
  4. We touch upon all of these, as we create a modelling tool, which can describe itself using an action language.
  5. In this chapter, we will go over these different topics, and relate back to our work.
  6. \section{Self-describable}
  7. The idea of having a self-describable programming language is not new.
  8. Squeak~\cite{Squeak}, for example, is a Smalltalk interpreter written in Smalltalk.
  9. For execution, there are two options:
  10. either the Smalltalk code is executed from within a running interpreter, or the interpreter is translated to a different programming language, which can be compiled.
  11. The former approach offers self-modifiability at run-time, whereas the latter offers increased performance.
  12. The translator only works on a subset of Smalltalk though, which closely maps to C (the target language of the translation).
  13. It is possible to combine both approaches: first write and debug using the interpreter-in-interpreter approach, and afterwards translate that same code to a different programming language.
  14. The combination is actually the main motivation for their work: it is possible to create code in Smalltalk, a high-level language, and debug it with all provided tools, and afterwards generate C, a low-level language, and profit from its performance.
  15. A similar project is PyPy~\cite{PyPy}, a Python interpreter written in Python.
  16. The Python code that is used for the definition is again a subset of valid Python code, called RPython, which again gets mapped to C.
  17. Their main motivation is performance: by raising the level of abstraction from C to RPython, it becomes far easier to implement advanced interpreters (\textit{e.g.}, including a JIT compiler).
  18. Going over to the modelling world, there is already some work done on a self-describable meta-modelling environment.
  19. One such tools is XMF~\cite{XMF-mosaic}, which is a self-describable kernel for multi-level modelling.
  20. Its kernel conforms to itself, though it cannot modify itself due to the lack of side-effects to functions.
  21. While it offers a foundation for multi-level modelling, it does not include an explicitly modelled action language.
  22. In the Modelverse, we also want to explicitly model the MvK component.
  23. But as the MvK can hold all kinds of models, the MvK should be able to manipulate (another instance of) itself.
  24. This would mean that the MvK is explicitly modelled in the Modelverse, and therefore is present in the MvS.
  25. As such, an instance of the MvK can modify its own model in the same way as this was possible with Squeak.
  26. All tools provide an extensive model library, which is written in the language they implement.
  27. This is certainly the case for Smalltalk, where basically everything is a library, even primitive data structures such as integers.
  28. Tools can provide a minimal foundation, possibly hardcoded, with all other parts building upon this core.
  29. For example in PyPy, most libraries are implemented in pure Python code, whereas in CPython (the reference implementation), these are coded in C for efficiency reasons.
  30. The Modelverse is similar in this aspect, as it only has a minimal base of hardcoded operations, to which everything should be mapped.
  31. While this limits performance (since some operations require multiple primitive instructions), the amount of fixed components is minimized and thus the amount of modifiable code is maximized.
  32. Furthermore, it offers users insight into the working of the tool, without resorting to the kernel manual.
  33. Finally, new implementations of the kernel only require the reimplementation of the minimal core, with the complete library being reused as-is.
  34. \section{Action language}
  35. Several action languages are already in use today, to allow models with associated behaviour.
  36. We describe some of these languages:
  37. \begin{itemize}
  38. \item fUML~\cite{fUML} (foundational UML) is a frequently used language, often in combination with alf~\cite{alf}.
  39. It is referenced as the assembly language of MDA~\cite{AssemblyLanguage}, as many other languages get mapped to it.
  40. Work has been done to extend the library of fUML with external services, such as Java libraries~\cite{JavaUML,xMOF}.
  41. It is a quite elaborate language though, making it difficult to create a minimal core out of it.
  42. In its turn, this decreases the power of self-modifiability: a lot of constructs are built-in, and therefore their semantics cannot be changed.
  43. \item txtUML~\cite{txtUML} (textual executable translatable UML) provides a mere interface for the user, where all code gets translated to Java.
  44. This has the advantage that existing tools, such as Java debuggers, can be reused.
  45. However, the question is as to whether existing general purpose debuggers are at the right level of abstraction, as they do not provide tracability information.
  46. Mapping to Java has the additional problem that it is not completely platform independent, as there would be a need for a Java interpreter at the platform.
  47. Additionally, Java is not explicitly modelled and therefore we would not be able to model everything explicitly.
  48. \item EOL~\cite{EOL} (Epsilon Object Language) is a language commonly used for model management purposes.
  49. Several closely related languages are also specialized for specific purposes, such as ECL (Epsilon Comparison Language), EML (Epsilon Merging Language), and EGL (Epsilon Generation Language).
  50. While it has wide support, and is based on the familiar Object Constraint Language (OCL), there is a lack of a complete metamodel.
  51. As the code is purely textual, and not explicitly modelled, it is impossible to combine with strict metamodelling, where level-crossing links (or accesses) are disallowed.
  52. Again, the language in itself is fairly large, making it difficult to implement a simple, minimal core.
  53. \item Kermeta~\cite{Kermeta} probably comes closest to the Modelverse.
  54. Their action language is explicitly modelled, and there is the possibility for both graphical and textual editting of action language constructs.
  55. However, they are limited in the use of strict, static typing and strict metamodelling, which is a potential problem in combination with model management operations.
  56. \end{itemize}
  57. We can identify two different design goals for action languages: operational semantics (examples in~\cite{UMLWithMeaning}), and model management operations (examples in~\cite{EOL}).
  58. Both goals have very different requirements.
  59. For the modelling of operational semantics, it is desired that the action language is also explicitly modelled, and therefore can directly reference the accessed values.
  60. Furthermore, we want to have requirements that are similar to strict metamodelling, where the action language is only able to access elements at the same level.
  61. It is therefore not possible to use such languages for the definition of model management operations: language constructs can only access a single level.
  62. For the modelling of model management operations, most approaches take some distance from the model itself, causing the language to not be modelled explicitly.
  63. This allows them to ignore strict metamodelling requirements, and access arbitrary elements from the model, even if they are at different levels.
  64. While this allows for model management operations, it is not possible to model the language, and therefore also impossible to use model management operations on themself, breaking self-describability and self-modifiability.
  65. While the definition of operational semantics is not impossible, there are no constraints on the modifications done to the model, which is a potentially dangerous operation.
  66. Due to this discrepancy, both of which we want to support in the Modelverse, there is a need for two different views: one specifically designed to define operational semantics, and another one to define model management and other core functions.
  67. Languages also come in different representations, with purely textual being a popular choice for action language due to the similarity with programming languages.
  68. For the combination of behaviour and structure, however, we want a hybrid of these approaches: textual for the action language, but graphical for the structural metamodelling language~\cite{TamingMultiParadigm}.
  69. As the action language model is also modelled explicitly, it is automatically possible to modify action language constructs with the graphical environment.
  70. The Modelverse takes the same approach as~\cite{TamingMultiParadigm,Kermeta,JavaUML}, as all tools are purely graphical internally, but with a textual front-end that will generate the appropriate models automatically.
  71. In terms of debugability, many tools at the moment support some kind of execution traces~\cite{OpenSourceTools}, which can aid in debuging.
  72. Some, however, implement this through the use of an API that is exposed by the virtual machine that executes the code~\cite{RuntimeModelForFUML}.
  73. While this is a possible way, it makes clear that the virtual machine holds parts of the state that are not present in the state that is stored.
  74. Implying that the execution state is not explicitly modelled, and therefore not user-modifiable or debugable.
  75. It furthermore also raises questions as to whether the provided API is sufficient for all goals the debugger tries to solve.
  76. In the case of the Modelverse, no state whatsoever is stored in the virtual machine (the MvK), and everything is written to the MvS.
  77. Debuggers can therefore simply access and modify the complete execution state as if it were a regular model.
  78. Work based on traces, such as multi-dimensional trace files~\cite{TowardsScalableExecutionTraces}, can therefore be built on top of our provided execution state.
  79. Finally, there is the formalisation aspect.
  80. Most languages are formalised by mapping to either fUML or Java.
  81. While this is a viable approach, this makes us dependent on the target language, reducing interoperability.
  82. An approach that lies closer to our approach in the Modelverse, is the mapping to graph transformations, as is done by~\cite{DynamicMetaModelling}.
  83. As the MvS is conceptually a graph, a mapping of behaviour to graph transformations seems ideal.
  84. \section{(Meta-)Modelling tools}
  85. The last aspect to look at, is the functionality of current meta-modelling tools, in relation to the Modelverse.
  86. WebGME~\cite{WebGME} is a web-based tool, focussed on collaboration between multiple users.
  87. It really focusses on the collaboration aspect by offering model-based version control.
  88. Support for prototype-based inheritance distinguishes it from other tools.
  89. While it is a powerful metamodelling tool, it does not support model transformations.
  90. It is furthermore not possible to add in model transformations, as there is no minimal core on which transformations can be built.
  91. The Modelverse doesn't support model transformations at the moment, either, but these will later be implemented on top of the minimal core that is present.
  92. The architectural split between behaviour and storage was replicated in the Modelverse.
  93. In contrast, the behavioural part, the MvK, will be completely modelled in the action language defined by the Modelverse.
  94. AToMPM~\cite{AToMPM} is another web-based meta-modelling tool with support for model transformations.
  95. While there is a notion of collaboration, this is not to the same degree as WebGME.
  96. The Modelverse has no direct notion of collaboration build-in, as such operations need to be implemented on top of the minimal core.
  97. The Modelverse doesn't include a default interface at the moment, as it only consists of the service.
  98. Melanie~\cite{Melanie} is a graphical multi-level modelling tool.
  99. It has support for automatic emendation (changes to a meta-level are automatically propagated to the lower levels), and transformations.
  100. While it comes with a graphical environment, there is no support for multiple users.
  101. MetaDepth~\cite{metaDepth} is another multi-level modelling tool.
  102. It is purely textual, and therefore feels more familiar to programmers.
  103. While it lacks transformations, constraints and operational semantics can be defined through the use of action language in the EOL formalism.
  104. The Modelverse supports multi-level modelling by default, but mainly because there is no restriction on re-instantiation of previously instantiated elements.
  105. Advanced features, like emendation, or even potency, are not supported by default.
  106. Thanks to the minimal core, however, potency, or similar techniques, can be added in, as was done by XMF-Mosaic~\cite{XMF-mosaic}.
  107. XMF-Mosaic~\cite{XMF-mosaic} is one of the only self-describable multi-level meta-modelling tools.
  108. It is purely textual and there is no support for multiple users.
  109. However, it is also based on a minimal kernel, which is self-describable.
  110. The action language they use, EOL, is not self-describable though.
  111. Internally, the Modelverse makes fairly similar decisions, as for the use of a single common metamodel.
  112. While this is the only way of looking at the model in XMF-Mosaic, the Modelverse allows different conformance dimensions, of which one might actually be a \textit{real} conformance dimension.
  113. Kermeta~\cite{Kermeta} is similar to the Modelverse.
  114. It offers a hybrid syntax of graphical and textual, and also has a meta-model for the used action code.
  115. There is, however, a strong focus on strict and static typing, which, combined with strict metamodelling, can become very constraining for model management operations.
  116. Kermeta models many constructs explicitly: there is even a metamodel for primitive datatypes.
  117. These primitive datatypes however, just come out of a (system) library, and are therefore not easily changable, or visible, by the user.
  118. While all mentioned tools have their specific application (and research) domain, the Modelverse tries to combine features of all tools.
  119. This is done through the use of the minimal core, on which the features of other tools can be built.