Stuck with your Java monolith? Automatic refactoring might just be within reach

Stuck with your Java monolith? Automatic refactoring might just be within reach

Microservices seem to have won the software architecture battle, but it’s not all green-field development, and breaking a monolith up into more manageable chunks can be quite a daunting task.  To tackle it, fresh-out-of-stealth company vFunction now provides a platform that should help Java developers modernise their code. 

However, it isn’t the only firm to offer such capabilities, as IBM reminded us by making its own tool generally available this week.

Mono2Micro was first introduced in May 2020 and is part of IBM WebSphere Hybrid Edition “for migrating WebSphere Application Server applications to the cloud”. To come up with refactoring options that should help turn a monolith into smaller units, Java developers need to let the service do some source code analysis for figuring out data dependencies before instrumenting the app and running it as they usually would for their business use cases.

In a second step, the runtime logs and other data gathered is used to come up with two refactoring options called “business logic partitioning”. This only takes into account the runtime analysis results, and a “natural seams partitioning” that also factors in the outcome of the static analysis. The proposals are based on machine learning strategies (think clustering mechanisms) and come in the form of reports and graph JSON. 

While the latter can be visualised to show class combinations that the tool thinks would make for sensible microservices, the reports should provide a bit of reasoning behind the architectural decisions made, though custom refactorings can be added as well. 

The options presented can then be used to automatically create a code foundation for the new microservices via refactoring, though the tool also seems to spit out a list of things that might need manual adjustment in order to have the app work as expected.

vFunction seems to follow a similar approach as it advertises a “combination of dynamic analysis of actual usage patterns enriched by static analysis of the existing binaries” as its secret sauce. To come up with the new microservice structure, vFunction also defaults to “data science, deep graph theory and clustering algorithms”, though it doesn’t seem to focus on the class concept in the same way IBM does. The company nevertheless promises automatic creation of microservices using the original app code, which is meant to speed up the modernisation process. 

Compared to Mono2Micro, the company also mentions capabilities to automatically migrate apps built on older Java frameworks to their modern equivalent, which could be useful for complex Spring applications and the like, and keeping track of the architectural state of different apps.

Organisations toying with the idea of becoming cloud native once they’ve gotten rid of the monolith will also be interested in vFunction’s services for refactoring applications for the Kubernetes platform or Red Hat’s OpenShift. Details on that and the pricing however are available on request only – which brings us back to IBM and its good old “Contact us” button. Maybe that could use some refactoring as well.