Sponsored OSS Development: Making Snipmatch 2.3 fit for any language

The following is an experience report by Klaus Landsdorf and Stefan Macke, two developers working at Alte Oldenburger Krankenversicherung AG, a German health insurance provider, about how sponsored Open-Source Development made Code Recommenders Snipmatch work for their use case: managing hundreds of code snippets for several languages (other than Java).

Among other languages, Alte Oldenburger Krankenversicherung AG uses Software AG’s Natural, a 4GL programming language optimized for accessing Adabas databases. As Natural requires quite a bit of boilerplate code, over time the development team accrued a collection of nearly 1,000 code snippets that relieved us from manually writing all this boilerplate code. But a collection of snippets this large requires the right tool to manage it.

At first, Eclipse’s built-in code templates feature seemed a good solution to this problem. Unfortunately, managing a collection of snippets this large as code templates turned out to be quite cumbersome.

In particular, sharing a template created by one developer with his colleagues required manually exporting the template as XML on the developer’s workstation and then manually importing it on the workstation of every colleague. Over time, our software architects created many such templates, but due to the manual steps involved, these sometimes did not reach all of the team members. What made matters worse is that at Alte Oldenburger every developer uses more than one Eclipse environment to better fit the different tasks in the development process. But as everybody knows: more than one almost always means that one is forgotten.

Moreover, as soon as more than about 200 templates were used, Eclipse versions from Kepler up to Mars were susceptible to crashes during code completion. And even if Eclipse did not crash, using more than 700 templates made Eclipse’s just way too slow to be usable.

Natclipse > Templates preferences

In late 2015, two of our developers thus evaluated Snipmatch 2.2.4 as an alternative to Eclipse’s built-in template feature. The fact that Snipmatch allows sharing of code snippets using Git meant that it integrated well with a workflow in which snippets were shared freely among a large group of developers. Unfortunately, at that time Snipmatch only worked when writing Java code. But we at Alte Oldenburger saw the potential of this tool and approached Codetrails to ask for generic file support in Snipmatch, compatible with all Eclipse versions from Kepler on (Bug 484013).

In our discussions with the Snipmatch committers working at Codetrails, we outlined our requirements: to be able to share nearly 1,000 snippets of Natural code as well as being able to share snippets for XML, Gradle, Xtext, Java EE 7, and HTML5/CSS3 in the future. As we saw the usefulness of generic file support beyond our own use case, we also wanted the required changes to Snipmatch to be published as Open Source.

Codetrails agreed and we started our two month collaboration. Codetrails implemented our ideas perfectly and very quickly. Now that we have been using a development version of Snipmatch for nearly a month, we would sorely miss it if we had to go without. It also works very well in both IDEs used here at Alte Oldenburger: Software AG’s NaturalOne IDE and Natclipse, an IDE by Innowake based on Eclipse Kepler, who kindly supported us on this project by granting two testing licenses to Codetrails for six months..

The goal was to finalize Snipmatch 2.3 in time for Eclipse’s Mars.2 release. This goal too was reached; every user of Eclipse Mars.2 can now enjoy Snipmatch snippet completion in arbitrary files.

How Snipmatch is used at Alte Oldenburger

As mentioned above, we have defined so many snippets because Natural requires lots of boilerplate code. Therefore, we use Xtext to generate Natural CRUD layers for Adabas files. The layers are integrated seamlessly into our programming life cycle by generating snippets via Xtext which are then deployed via Git. This helps to ensure that developers are actually using the CRUD layers due to the ease of use of the code completion feature.

Log4Nat and NatUnit are open source logging and testing frameworks for Natural developed by Alte Oldenburger. Snippets using Log4Nat and NatUnit have also been committed to the snippet repository in order to allow us to build Natural test cases using Snipmatch’s snippet completion.

The Snipmatch Snippets view showing 1,132 snippets

Providing code templates as snippets to our team of 20 software developers is very easy with Snipmatch: Snippets are created by software architects and experienced Natural developers. Junior developers can then use the snippets via snippet completion to automatically apply a modern programming style based on more than 20 years of experience in developing Natural applications. Our students can also introduce new styles of programming into the snippet repository. This mixture of the whole team’s knowledge kept in a Git repository takes us to a whole new level of productivity. Development tasks that took days before can now be done in just a few hours, and the work of hours can be done in mere minutes. After just one week all of our developers had adopted the new snippet process. Changes to snippets reach all developers immediately by simply sharing the snippets through a single right-click in Eclipse.

Snippet sharing context menu

Snipmatch 2.3 helps with its snippet completion, but what we find even more interesting is its tags and terms search feature. Our Natural application was originally created by Spanish developers and then got extended by English developers. Today, we use German terms for our domain model. Thus, the codebase uses three different natural languages for variable and module names. In pair programming sessions Snipmatch helps us to combine these three languages when searching in code completion. We combined all of the known terms so that our developers now have the option to use either the terms they know or to learn the new terms.

Recently we created a Java EE snippet repository for our Java EE developers, who are our most junior developers. With this repository they have the ability to build a reusable knowledge base for the future in collaboration with our software architects. Java EE 7, Xtext, HTML5, and CSS3 are also suitable for building snippets for everyday tasks, database connections, or usage of build tools. We’re really looking forward to where we might be in a year from now.

Team work with clean code and similar code structures for different programmers in such a short time – that’s what we searched for and finally found in Snipmatch 2.3! We hope that other users of Snipmatch enjoy the results of our sponsoring efforts just as much as we do.

Install Snipmatch Download Eclipse Mars.2

Add new comment