The recipe (and dependency ingredients) for code migration

Moderne is a code automation company that works to accelerate software development by automating code migration and fixes across a company’s application stack and codebase. 

The OpenRewrite team also collaborated with Micronaut to develop and make OpenRewrite recipe a recommended upgrade process for the latest 3.x version of Micronaut, the JVM-based full-stack framework for building microservices and serverless applications.

Here’s the problem…

As we know, software application development has undergone significant changes in the last ten years, driven by the adoption of agile cloud-native development, DevOps and the growth of the API economy. 

This means (obviously) that it is no longer built completely in-house, instead, it is integrated from open source and third-party components. 

Maintaining this type of software (again, obviously) requires keeping up with the constant changes to all of these components, and tracking ongoing common vulnerabilities and exposure (CVE) fixes and managing thousands of APIs. 

It is estimated to take up to 30% of the development team’s time, which acts as a drag on innovation and software quality. The growth in code volume, variety, and velocity have only exacerbated the problem.

OpenRewrite foundation

Moderne was founded to tackle this problem by Jonathan Schneider and Olga Kundzich, who previously worked together at Pivotal with a number of enterprise customers on an unrelated technology. Moderne’s technology is based on OpenRewrite, a large-scale automated refactoring tool for code (initially Java) that Schneider developed while at Netflix.

The technology originated at Netflix because of its culture of freedom and responsibility.

Gating different parts of the software delivery lifecycle to coerce engineers to change code was anti-cultural, so Netflix engineers with a focus on developer productivity had to think of ways to offer help instead. Code automation was the only scalable solution, which is how OpenRewrite was born. 

Moderne has picked up OpenRewrite and expanded its scope to allow for full framework migrations like Spring Boot 1 to 2 and JUnit 4 to 5, security vulnerabilities fixes and created many more high-level building blocks that make authoring custom transformations easier than ever.

Moderne has also begun expanding into other languages other than Java starting with infrastructure-as-code with Kubernetes, YAML and XML refactoring.

“With the move to the software supply chain, software development has become industrialised. We are building more and more custom software, but producing it more quickly by integrating building blocks such as open source software and vendor APIs,” said Schneider, who is now co-founder and CEO of Moderne.

“We need an open ecosystem for developing and distributing automation for these tedious code maintenance tasks such as upgrades, common vulnerabilities & exposure (CVE) patching and internal API maintenance. It can only be solved by a community through composing more and more complex refactoring operations and validating them on more and more code.”

Schneider: Open ecosystems always.

The Moderne SaaS solution applies OpenRewrite recipes across a large-scale codebase to search and transform millions of lines of code in minutes. This organisation-wide transformation capability includes code visibility from source to production to prioritise remediation on source code that is demonstrably used in critical production systems.

The secret sauce recipe

OpenRewrite calls a single code search or transformation operation a recipe. It provides a number of building block recipes such as find method, change method, find transitive dependency, upgrade or exclude dependency. These recipes in turn can be composed into more complex recipes by grouping them together into a composite recipe. 

When the building blocks are not enough, a recipe can be written as a program in the same language as the code that is being transformed, which encapsulates complex logic with the full expressiveness of the language already familiar to developers. These building blocks abstract away many of the details to ensure that edits that we make to source code obey the original style of the project.