Try our first Early Access Program for MPS 2018.1

We are happy to start the year with the right foot forward and our first 2018.1 EAP. In this version, the main dish is improvements to the Smodel query and the option to display the reflective editor for a subtree. You can see all the other fixes here.

SModel query scopes improvements

Smodel queries that are useful in migration scripts and in the console plugin now behave differently towards the scope they operate on. Read-only models are no longer filtered out from the scopes specified as a query parameter. If a scope is declared as a parameter for a specific query, the query is executed on the whole scope including any read-only models. But if the scope is not specified, the default scope still only contains writable models.

Show reflective editor for the subtree

The reflective editor can be shown for a whole subtree.

To do so select the node, right-click and choose “Show reflective editors for subtree” or press Cmd/Ctrl+shift+[

Before:

refl_before

After

refl_after

Showing the reflective editor for just the node is still available from the context menu, or by pressing Cmd/Ctrl+[

For going back to the regular editor, press Cmd/Ctrl+], Cmd/Ctrl+Shift+] or right-click the option “Show regular editor for the Subtree”.

Please use our issue tracker to report bugs or new feature requests.

 

Have a nice day!

Your JetBrains MPS Team

The Drive to Develop

Posted in Announcement | Tagged , , , , , , | Leave a comment

MPS 2017.3.2 is ready

MPS is celebrating the end of the year 2017 with another bug fix release. You can download MPS 2017.3.2 and enjoy its improved stability.

See you all soon in 2018.1!

Your JetBrains MPS Team
The Drive to Develop

 

Posted in Announcement | Tagged , , , | Leave a comment

Releasing MPS 2017.3.1

Despite all the celebration after releasing MPS 2017.3 we continued fixing issues so that today we can announce the first bug-fix release – MPS 2017.3.1

Have a great day!

Your JetBrains MPS Team
The Drive to Develop

Posted in Announcement | Tagged , , , | Leave a comment

MPS 2017.3 is Released!

This is the last release of MPS for this year. We are excited about how far MPS has come and where it’s going. We’re always listening to our community in deciding which new features to implement in order to help you build incredible projects with MPS.

Download MPS 2017.3 

For this release, there are new features and enhancements in four key sections: Editor, Generator, Build language, and miscellaneous.

 

Editor:

  • Generic placeholders
    We’ve introduced the notion of a generic placeholder. A generic placeholder may be used as an empty position marker in any child collection in any language, and it may optionally hold additional content. By default, this placeholder node is represented in the editor as an empty space and behaves in a transparent way – you can invoke the completion menu on the placeholder node to replace it with a valid child node, or you can press Enter to add a node in the next sibling position. The Control/Cmd + Shift + Enter key combination inserts the placeholder at the current position within a collection.

GenericPlaceholder

  • Free-floating comments
    A generic DSL commenting functionality has been implemented using the new generic placeholder. To take advantage of this, simply import the jetbrains.mps.lang.text language or the general-purpose devkit. This will give you a fully editable multi-line text language with support for basic styling (bold, italic and underlined), clickable hyperlinks, and embedded nodes (code). Just type “[” when positioned on a generic placeholder to start typing your comment.
    In addition to this default commenting language, you can create a custom one to meet your specific needs.

FreeComments

  • Customize font family for cell
    A new editor style font family in the editor definition is now available to enable customization of a font alongside its size and style properties. Use the fontFamily expression to reference any of the installed font families.

FontFamily

  • Select All
    A new action, SELECT_ALL, is now available to select the entire content across the whole editor. You can trigger it with the Control/Cmd + A shortcut, and customize its behavior for your own concepts by using action maps.

SelectAll

  • Undo for deleted nodes
    We’ve improved how undo works for deleted nodes. After undoing a root node deletion, you can still undo any previous modifications performed inside that root prior to its deletion.

Generator

  • Linking checkpoint models
    Checkpoints now allow resolving references in mapping labels across multiple generator phases. You can thus safely resolve references to nodes even if they were generated at an earlier checkpoint.
  • Avoiding unnecessary file overwrites
    The make process does not overwrite generated files that hold identical content to the one just generated. You can now rely on the fact that only the modified files get updated on disk.

 

Build language

  • A new way to copy module resources
    The ‘resources’ content root specified on modules now serves the purpose of copying resources into a deployed module. A migration has been provided to incorporate the file masks previously hardcoded in resource-copying templates.

Resources

  • Ant Tasks
    The MPS ant task provides full control over the repository contents with several new tags – module, modules and allmpsmodules.

Ant_tasks

  • Migration Ant task improvements
    The Migration Ant task is now more user-friendly.
    – Problems during migration make the ant script fail and are properly reported to the user.
    – We support all legacy attributes for specifying mps location – mps.home, mps_home environment properties, and the mpshome task attribute. The preferred way is to use the mps.home environment property.
  • Devkit packaging improved
    Devkit modules are no longer deployed as files but instead, are bundled into jar files just like other modules. A migration script has been provided to automatically update the devkit layout elements in your build projects with the new ‘module’ layout element.

 

Miscellaneous

  • NodePointer for child elements
    The nodePointer expression from lang.smodel can optionally reference not only roots, but also any named elements now.

NodePointer

  • Make considers model dependencies
    Make of a model also makes all the model dependencies that need to be regenerated. This saves time and helps avoid surprises.
  • Model clone improvement
    The Model Clone action correctly updates cross-root references for elements of the cloned model. The cloned model is now completely independent of the original model.

Clone (2)


So that’s it. We hope you like all the features that we’ve prepared for you. Our community is key for us so we’re always listening. Follow us on Twitter and join our slack channel to stay tuned for more updates and give us your feedback!

 

Have a great day!

Your JetBrains MPS Team

The Drive to Develop

Posted in Announcement | Tagged , , , , , | Leave a comment

MPS Community event is coming!

Dear Friends,

Our community is growing and we believe that the exchange of knowledge and experience is key to building better products with MPS. We are happy to announce our first MPS community event is happening Spring 2018. This event will focus on 3 main topics: sharing what everyone is doing with MPS, introducing the technology to new and prospective users, and explaining our future plans as the MPS team.

When and where?! Well, we think we have to decide this as a community, so we have created this 3-minute survey to help you get involved. Please answer this survey.

Have a nice day!
Your JetBrains MPS Team

The Drive to Develop

Posted in Announcement, Events | Tagged , , , , | Leave a comment

Our last Release Candidate for MPS 2017.3 is here!

We are happy to give you our third and last release candidate for this MPS 2017.3. For the list of bugs fixed, click here. The final release is just around the corner, so stay tuned for more news!

Please use our issue tracker to report bugs or new features.

Have a nice day!
Your JetBrains MPS Team

The Drive to Develop

MPS_20173RC3

Posted in Announcement | Tagged , , , , , | Leave a comment

Try the Release Candidate 2 for MPS 2017.3!

We are almost there, our final release of MPS 2017.3 is very close. Meanwhile, try the Release Candidate 2 for 2017.3. Some bugs have been fixed but if you find any more please report them to our issue tracker.

Have a nice day!
Yours,

JetBrains MPS Team

The Drive to Develop

MPS_20173RC2

Posted in Announcement | Tagged , , , , , | Leave a comment

The first Release Candidate of MPS 2017.3 is available

Finally, the first Release Candidate of MPS 2017.3 is here. The final release is around the corner and we can’t wait for it! Check out the new features and please report any bugs you find to our issue tracker.

Have a nice weekend!

Yours,

JetBrains MPS Team

The Drive to Develop

MPS_20173RC1

 

Posted in Announcement | Tagged , , , , , | Leave a comment

MPS 2017.3 Public Preview is released

We have a special treat for you today: the MPS 2017.3 Public Preview is now available. Every day we are getting closer to our final release of 2017.3.

Stay tuned for more news and please report any bugs you find to our issue tracker.

Have a nice weekend!

 

Yours, JetBrains MPS Team

The Drive to Develop

Posted in Announcement | Tagged , , , , | Leave a comment

Domain-Specific Languages for Business Applications – Modelling User Interfaces

Learn about a DSL made to address the unique challenges of business application development, especially business logic handling and user interface design.

By Daniel Stieger, Wolfgang Messner, Oscar Rodriguez and Vaclav Pech. 

Business application development covers various problem domains, like data persistence, business logic handling, and user interface design. A single DSL is not sufficient to achieve productivity and quality gains, nor are multiple DSLs that are not neatly integrated with each other. Only a holistic approach, where several DSLs can be used seamlessly to model solutions for the different problem domains, can bring significant improvements in development.

In this article, we will showcase a DSL we are using at modellwerkstatt.org to model standardized user interfaces for our business applications. The inherent logic of the DSL is capable of visually displaying whole entity-graphs in a very simple, declarative manner. We will point out how easy it is to interact and weave in plain Java code, an interaction that leads to more flexibility and safety, for example, type-safety. After distinguishing between internal and external DSLs, we will introduce JetBrains MPS and dive straight into our UI DSL. Finally, we will summarize our thoughts on DSL interaction and extension.

Internal vs. External DSLs

Domain-Specific Languages (DSLs) are widespread in software development nowadays. They can be defined as “programming languages that raise the level of abstraction beyond programming by specifying the solution that directly uses concepts and rules from a specific problem domain.” (Kelly and Tolvanen, 2008). While GPLs (General Purpose Languages), like Java or Kotlin, are widely used across various problem domains, DSLs are tailored to be very productive in a specific domain. They provide suitable abstractions aligned with the problem domain to express solutions in a neat and succinct way, often usable by non-programmers. Typically, SQL is referred to as an example of a DSL. SQL allows users to handle data, tables, and databases without any programming knowledge. SQL provides a higher level of abstraction with specific concepts like “select” or “update” in the domain of “data in rows and columns.” SQL is expressive and focused, but at the same time, it pins down the user to a particular problem domain. Other well-known DSLs include CSS, Regular Expressions, and XPath. In addition to these commonly-used DSLs, numerous highly-specific DSLs have been developed in-house by many organizations to help their users capture their business knowledge and automate the generation of repetitive GPL code.

DSLs implemented as so-called internal DSLs, building on a hosting GPL, are widespread. According to Fowler’s Domain-Specific Languages, “Internal DSLs are a particular form of API in a host general-purpose language, often referred to as a fluent interface” (Fowler, 2010). An internal DSL defines concepts and operations that exist only in a specific domain, providing additional assistance in that domain. JMock and JooQ are well-known examples for internal DSLs built on Java. However, internal DSLs have big limitations. The syntax of an internal DSL can only be what the syntax of the hosting GPL allows. Without that, the resulting code could not be parsed and compiled by the host-language compiler. Furthermore, IDE support for syntax highlighting, code completion and type checking is also restricted and depends on the hosting GPL. This might not only limit the usage of internal DSL to GPL-savvy developers, but it also imposes heavy constraints on syntax and visual representation.

In contrast, SQL could be characterized as an external DSL, since SQL is not embedded or hosted by another GPL. SQL comes with its own keywords, operations, and syntax. It was conceived without any (syntactical) relationship to any other GPL; it is completely independent. External DSLs can be optimized to capture all the necessary information regarding the problem domain, maximizing expressiveness without any restrictions on readability and comprehensibility. The visual representation, the look and feel of an external DSL, could be built to suit language requirements as best as possible, not only for developers, but also for the domain experts themselves. Only then can formulating, communicating, and understanding solutions for a particular problem domain be improved. This was the very reason for coming up with DSLs in the first place.

Nevertheless, external DSLs come with some drawbacks of their own. First, since the language is not hosted by a GPL, out of the box, there is no IDE available. Especially so if the DSL targets a very specific narrow domain, where the low number of potential DSL users do not justify the effort required to create the language-specific tooling or a complete IDE. Yet, DSL users demand intelligent tools to provide assistance and make them productive. Second and more seriously, external DSLs cannot easily reference external artifacts, e.g. code written in a GPL or declarations persisted as XML. An external DSL is somehow closed in itself, as long as there are no importers and exporters (generators to produce executable GPL code) developed additionally. For practical purposes, interacting with the whole development environment is crucial, because not all aspects of a software solution can be provided with a single DSL – which is where language workbenches come in helpful.

JetBrains MPS

JetBrains MPS is a language workbench designed to define, reuse, and compose DSLs, providing additional tooling for these languages. Unlike other environments, MPS does not rely on the parser technology to provide extensive tool support. Usually, tools and compilers parse the textual representation of code with well-defined grammar to instantiate the abstract syntax tree (AST). This structured tree is then used to look up and transform given information into executable code.

MPS employs a projectional editor to manipulate the AST directly. While the projectional editor might look and feel like a text editor, the user is editing the tree structure in real-time. The code is not persisted in parsable text – the AST itself is persisted, thus avoiding any need for parsing. So, no syntactic ambiguities can arise, no semicolons or brackets are needed to delimit concepts. The projectional editor allows for concise and appropriate domain-specific visual representations. Code completion and error checking can be easily provided by investigating and browsing through the AST, all this is supported by the MPS IDE in a straightforward manner. To sum things up, MPS provides general tool support for a DSL, so that it has not to be built specifically.

Building on the AST as a core foundation of MPS comes with a major advantage. Since grammar ambiguities are eliminated, DSLs can be combined in any possible way. Existing DSLs can be extended and enriched with new concepts. DSLs can be built upon each other, inheriting features and capabilities. This allows for simple reuse of existing language concepts, speeding up development but also fostering a common base.

Let’s turn to our showcase to experience this notion from a practical perspective.

DataUx – a UI Language Built Upon Java

The idea of language combination is nicely demonstrated with DataUx, a language we’ve built at modellwerkstatt.org to specify user interfaces for data-rich applications written in Java – typically business apps like invoice management or stock tracking. DataUx provides various language concepts to specify forms for data entry, tables for the visualization of collections, and layouts. DataUx draws on the idea of advanced property binding to provide actual data-values for the UI elements. Java Objects with bean properties (getter and setter for specific identifiers) are arranged in an object graph. Then – and this is very special from our point of view – the whole graph is bound to the UI. In our simple example, an Order object with various properties contains also a list of Order-Positions. The following screenshot shows a UI for an Order with its properties and positions. The second screenshot is the specification with DataUx of this very UI.

Screenshot 1: Demo-Application UI with one Order containing multiple Order-Positions.

Screenshot 2: Order UI specification for our Demo Application with the DataUx language in MPS.

Screenshot 2 above shows the ‘Order main page’ which is bound to a list of Orders. In a Grid Layout consisting of only one column (1* = maximized with weight 1), we placed two UI elements in two rows, the first one minimized as much as possible (-1), the second one maximized again (1*). The delegate-form shows values from six properties of the Order divided up into 2 columns; the table shows the list of OrderPositions of our Order. The DISABLED option sets the whole form into read-only mode; the table is read-only by default anyway.

A key idea of DataUx was inspired by beans binding and the master-detail pattern. Each PagePane is capable of visually representing a graph consisting of objects, where a “selected object” exists for each object type. In our example, two object types are involved: the Order and the OrderPosition. Thus two selections are relevant: the currently selected Order and the currently selected OrderPosition. Now, all UI elements have to be bound to an object type to get loaded with the currently selected object of that type. Within single UI elements, properties of objects can be accessed and bound.

The Delegate Form is bound to the currently selected Order, the Table is bound to the list of positions of the currently selected Order (written as Order.pos). Therefore, the delegate form can visually display properties of the Order object, whereas the table can show a visual of the OrderPositions properties as columns. Five properties of OrderPosition and their column-width are declared.

In our “selected object” logic, the table is not only used to display the lists of objects, it also determines the selected object. The selected row in the table corresponds directly with the “selected object” of that particular type. In our example, changing the table selection will change and define the selected Object of the type OrderPosition. Thus, we could enhance our UI by presenting a visual of the details of an OrderPosition (its properties) in another form, bound straight to OrderPosition.

Our “Order main page” from screenshot 2 is typed as a list of Orders, but when passing in only a single Order, that Order automatically becomes the selected object of that type. That is a special feature of our PagePane concept. If we passed multiple Orders to that page, an additional table would be necessary to define a selected Order. Only then a selected Order could be provided, which is necessary for the detail form and the OrderPosition table. A more complex example is shown on screenshot 3, where multiple Orders are expected. As suggested in the last paragraph, we added a detail form to show the properties of the selected OrderPosition.

Screenshot 3: More complex UI with master-detail arrangements for our Demo-Application.

Drawing on this object-binding logic, one can easily specify UIs for complex object graphs with DataUx. The user binds UI elements to an object type to access particular properties of that object. When executed, the UI element gets loaded with the currently selected object of that type. That’s probably the most complex matter that has to be explained when using the DataUx language. However, this object-binding logic is checked by the typesystem of DataUx, together with many other consistency checks. Context-sensitive completion and even an “autocomplete UI element” is implemented to provide intelligent editing.

What is remarkable in the context of our DSL discussion is the relationship between DataUx and Java. Obviously, even though DataUx is not compatible with Java syntax, it references Java concepts like properties and classes. Even type-checking rules based on Java are present. Furthermore, in between the UI elements, external Java artifacts are referenced. How is this achieved?

JetBrains MPS ships with a full-featured Java implementation. This GPL is implemented in MPS, exactly in the same way as a custom DSL would be. A nice projectional editor conveying the look and feel of a smart Java text editor is in place, which supports the definition of classes and interfaces, their members, and of course expressions. Since MPS also comes with a jar importer, it can be used as a stand-alone, full-featured Java IDE. We took advantage of this Java implementation and extended it with DataUx. This allows us to reuse powerful concepts, especially expressions and types. By doing so, DataUx gets basic programming support without any effort.

When specifying UI elements with the DataUx language, users can reference declared Java objects and their properties, as long as they are loaded and available in the IDE. Smart scopes for class references, properties or selections are calculated while editing. As seen on screenshot 2, the DataUx option “Table Summary Line” provides a closure-similar concept with a variable labeled as “allObjects” (the type would be list<OrderPosition>). To the right, the option is expecting a Java expression returning a string (type Java.lang.String). In our example here, the static method sum() from the MyUtil class is called. Though, in the context of this option, any valid Java expression is possible, starting from method calls over string concatenations to Java variable references. Smart scopes for all references are calculated specifically in the option’s context. All expressions are type checked.

The DataUx language is taking full advantage of the existing MPS Java language concepts, specifically expressions and typesystem handling, which are typically very complex elements of a language. Reusing Java expressions in the DataUx language, while quite straightforward, delivers additional value to the language user. Expressions deliver a great deal of variety to adapt to specific use-case requirements, without having to fall back to some externally defined,  unintegrated, plain programming code. It is also the capability of extending another language that delivers the key advantage here: while still not being dependent on the syntax of the MPS Java language, we are able to easily reference concepts declared in that language, for example, a static method called in the table option “Table Summary Line”.

DataUx was developed for one of our major customers, an Austrian retailer. Eight developers on the customer’s team are using DataUx to implement all the necessary UIs, without resorting to any additional aspects of the UIs in plain Java code. The development of the language could be achieved in a couple of days, once the idea and the structure of the language are set. The UI runtime with its several implementations in different technologies took us longer.

DataUx is currently available via GitHub.

Conclusion

DataUx is a very straightforward DSL that makes UI design accessible to non-programmers. With its flat learning curve, almost no explanation is necessary. It is also very easy to understand and maintain existing UIs. Furthermore, a user interface specified with DataUx is technology-independent when it comes to its implementation. A very important advantage, since UI technologies are changing swiftly these days. In fact, we provide DataUx runtime environments written for Apache Pivot, JavaFX, Vaadin, and HTML5. The user can just pick the desired platform and MPS will generate the necessary code from the DataUx UI descriptions.

DataUx demonstrates how JetBrains MPS is capable of mixing external DSLs, by letting DataUx extend the internal Java DSL implementation. While maintaining an attractive visual representation, important Java concepts like expressions are reused in DataUx. It is also this language extension that allows DataUx to interact with declarations made in Java. Generally, with MPS, languages can reference concepts from other languages and, in this way, reference specifications modeled with other languages. The projectional editor works with the AST and lets language creators build, reuse, and modify languages, but most importantly, lets different DSLs interact with each other. MPS is fostering interaction between different problem domains.

mps_modellwerkstatt.png

Figure 1: Multiple DSLs for business application modeling, extending each other.

Indeed, defining the user interface for a business application with DataUx is only one part of the story. Typical business applications are crossing multiple domains like data persistence (e.g. SQL querying and mapping), business logic and user interfaces. As JetBrains MPS allows interaction between DSL, we devised a language for each specialized part of a business application (see figure 1). Three highly targeted DSLs are available, forming a complete development stack. This way we can provide developers with the most expressive language for the task at hand while still building a complete business application within one development environment. Without integration barriers, high-level abstractions for each domain are given when building business software, improving ease of formulation, understanding, and thus maintainability and quality in the long term.

References

https://github.com/danielstieger/moware35/tree/master/dataux

http://www.jetbrains.com/MPS

Kelly and Tolvanen, 2008: Domain-Specific Modeling: Enabling Full Code Generation, Wiley-IEEE Computer Society.

Fowler 2010: Domain-Specific Languages, Addison-Wesley Educational Publishers Inc.

Posted in Announcement | Tagged , , , , , | Leave a comment