Published Jul 16, 2024

SE Radio 625: Jonathan Schneider on Automated Refactoring with OpenRewrite

Jonathan Schneider, cofounder of Moderne, delves into the transformative capabilities of OpenRewrite, a tool that automates software maintenance with AI-powered refactoring, recipe collaboration, and multi-language support, ultimately enabling developers to modernize code and address security vulnerabilities efficiently across repositories.
Episode Highlights
Software Engineering Radio - the podcast for professional software developers logo

Popular Clips

Episode Highlights

  • Language Support

    OpenRewrite's language support is a game-changer for developers working across different programming languages. highlights the tool's ability to handle languages like Java, C#, Groovy, and Kotlin, allowing developers to write recipes in their native language without needing to switch to Java 1. This flexibility is achieved through a technology called remoting, which enables recipes written in one language to operate on another's syntax tree 1. Schneider emphasizes the importance of type attribution for ensuring refactoring correctness, as it allows OpenRewrite to make stylistically consistent changes across diverse codebases 2.

    Recipes written in Java can benefit C# developers and vice versa. And that's a world I'm really excited about.

    ---

    This cross-language capability is crucial for seamless framework migrations and security fixes, making OpenRewrite a versatile tool for modern software development 3.

       

    AI Integration

    AI integration in OpenRewrite enhances its refactoring capabilities by providing targeted code modifications. Schneider explains that AI tools are used to identify areas for improvement and match them with existing recipes, ensuring precise changes without the risk of breaking code 4. This approach contrasts with probabilistic AI systems, which may introduce errors requiring extensive human review. OpenRewrite's AI-driven process is akin to a lean manufacturing system, offering low variability and high predictability in code alterations 5.

    A recipe, which is a computer, gets an AI to do targeted changes in code.

    ---

    By leveraging AI, OpenRewrite can efficiently manage large codebases, making it an invaluable tool for developers dealing with extensive software projects 4.

       

    Multi-Repo Management

    OpenRewrite excels in managing and refactoring across multiple repositories, a critical feature for modern software development. Schneider describes how the tool's commercial counterpart allows for mass pull request issuance and impact analysis across numerous repositories, providing a comprehensive view of code changes 6. This capability is essential for developers working in environments where code spans multiple repositories and organizations. The use of Maven and Gradle plugins facilitates the execution of recipes, enabling developers to make consistent changes across their projects 7.

    We're really trying to build these experiences that grapple with the fact that we don't work on one repository; we work on many repositories.

    ---

    By storing syntax trees as artifacts, OpenRewrite ensures quick and efficient refactoring processes, making it a powerful tool for large-scale code management 6.

Related Episodes