More than ever, software evolves in complex and changing environments such as cloud or embedded systems. In this context, self-adaptation became a major concern for a wide range of software systems. At the core of self-adaptation, there is a feedback loop and associated trade-off reasoning to decide on the best course of action. However, existing software languages do not abstract the development and execution of such feedback loops. Developers have to fall back to ad-hoc solutions to implement self-adaptation, often with wide-ranging design implications (e.g., explicit MAPE-K loop).

Furthermore, we observe informal feedback loops emerging in the evolution process of languages such as Python or Java through PEP (Python Enhancement Proposal) and JEP (Java Enhancement Proposal). These feedback loops rely on active contributions of the community through Enhancement Proposals to monitor the use and needs of the language users. However, existing software languages do not capitalize on monitored usage data of the language and its modeling environment. This hinders the continuous and automatic evolution of the software language based on feedback loops from the modeling environment and runtime software system.

We propose the concept of Self-Adaptable Language (SAL) to abstract the feedback loops at both system and language levels.

Motivation

To illustrate Self-Adaptable Languages, we describe four motivating examples based on the three following languages : MiniJava, RobLANG, and HTML. In this post, we will focus on the two examples based on RobLANG. RobLANG is a domain-specific language (DSL) to specify the actions of a robot, i.e., get information from the sensors, decide what to do, act using actuators (e.g., move),…

System-level feedback loops

First, let’s take a look at the abstraction of system-level feedback loops. System-level feedback loops allow the program to change its behavior based on the current context and environment to best satisfy a given trade-off. When abstracting this feedback loop at the language level, a way to perform this adaptation is to adapt the semantics of the language to perform the behavior changes.

For RobLANG, we choose a trade-off revolving around the time needed to perform an action and the energy cost of this action. The adaptation we propose for RobLANG is speed regulation. The goal of this adaptation is to reduce the speed of the robot motors when moving or turning to save energy. This adaptation will be realized by changing the semantics of the language constructs corresponding to actions that use motors (e.g., move, turn).

Language-level feedback loops

Now that we have seen an example of the abstraction of system-level feedback loops, let’s talk about language-level feedback loops. Language-level feedback loops enable languages to evolve to keep up with the demands of the changing needs of their stakeholders. These evolutions can impact syntax, semantics, and pragmatics (e.g., changes of the Java switch). The same process is also seen for DSLs to provide better abstraction to manipulate and understand the underlying application domain.

In RobLANG, we use domain-specific concepts such as “move forward”, “turn left”, or “sense position” that can be used to perform any movement. A possible scenario for language users would be to implement a function that performs more complex movement, e.g., a goto(x,y) function. A monitoring of the development environment detecting a quasi-systematic implementation of the goto(x,y) function would allow the Self-Adaptable Language to propose as evolution of the language the reification of the instructions composing goto(x,y) in a Go To concept in the abstract syntax of the language.

SAL: Self-Adaptable Language

As stated before, a Self-Adaptable Language (SAL) is a software language which provides capabilities to abstract the design and execution of feedback loops while performing trade-off analyses. Hence, a SAL allow the language user to focus on the core functionalities of the application, while relying on and possibly customizing the underlying adaptation process.

In essence, such a self-adaptable system, its users and their environments, the software modeling environment including the self-adaptable language, and the language engineering environment form a socio-technical modeling system, i.e., one interconnected, highly dynamic, heterogeneous, and adaptive ecosystem with several feedback loops and trade-off analyses.

The L-MODA conceptual framework

To discuss the fundamental concepts of SALs we propose L-MODA (Languages, Models, and Data) as a conceptual framework that characterizes the dependencies of (i) the software system at runtime including its data, (ii) the modeling environment with its data, models, and the self-adaptable language, and (iii) the language definition environment.

As shown in the feature image of this post, L-MODA is composed of two feedback loops, (1) the Runtime Feedback Loop, and (2) the Design Feedback Loop. The Runtime Feedback Loop uses run-time data from the software and language runtime with system and language specifications to adapt the semantics of the language at runtime. This feedback loop performs adaptations such as presented in the first example with RobLANG. The Design Feedback Loop uses data from the development environment as well as language and (possibly multiple) system specifications to adapt the language semantics, syntax, or pragmatics. In the second RobLANG example, this feedback loop performs the monitoring of the use of the goto(x,y) function and takes the decision to reify it in a Go To concept.

Self-Adaptable Virtual Machines

As first experiments, we proposed the concept of Self-Adaptable Virtual Machines which is the incorporation of the Runtime Feedback Loop in the operational semantics of a language. We designed these virtual machines with a pluggable architecture for modules to allow different stakeholders to implement adaptations. These virtual machines are composed of three parts :

  1. An operational semantics implemented in the form of a visitor
  2. An adaptation context containing :
    • The registry of usable adaptation
    • The goal models used to specify the trade-off, monitored context, and adaptations impact on the trade-off depending on monitored context
  3. The concrete feedback loop in charge of the Monitor, Analyze, Plan, and Execute phases

These first experiments show the ability to correctly adapt language semantics but emphasize, among other things, the need for an efficient implementation. Another limitation of these prototypes is the lack of control of what can or cannot perform the adaptations.

In this context, we built SEALS, a framework for building Self-Adaptable Virtual Machines. The SEALS Framework supports :

  • The definition of the abstract syntax and the nature (adaptive or not) of the language concepts.
  • The definition of the semantics and the associated interface, called correctness envelope, specifying how the semantics can be adapted.

Additionally, the framework provides dedicated concepts to specialize during the implementation of the adaptation process. The following figure presents how the framework can be used to implement an HTML Self-Adaptable Virtual Machines.

Adaptable virtual machine

The main advantage of SEALS-based Self-Adaptable Virtual Machines compared to handcrafted versions is the control over the adaptations that can be performed using the correctness envelope. The correctness envelope allows the language engineer to specify explicitly which part of the semantics can be changed, e.g., the progression of a for loop from i++ to i+=2, and ensure properties on those changes, e.g., changing i++ to i+=2 is valid but i+=20 is not.

To Learn More

More details on the vision and preliminary experiments can be found in the paper entitled “Towards Self-Adaptable Languages”, and the SEALS Framework is detailed in the paper “SEALS: A Framework for Building Self-Adaptive Virtual Machines”, both by Gwendal JouneauxOlivier BaraisBenoit Combemale, and Gunter Mussbacher. These papers are available in the ACM Digital Library, and the preprints in HAL. The artifact produced for the SEALS Framework is available on Zenodo DOI. The code for those papers is available on Github.

Interested in modeling?

Interested in modeling?

Follow the latest news on software modeling and low-code development

You have Successfully Subscribed!

Pin It on Pinterest

Share This