Key Concepts
- AI-Powered Modernization: Using AI tools like GitHub Copilot and autonomous agents to modernize legacy code, specifically COBOL.
- COBOL: A 65-year-old programming language still used in many critical systems, including banking and finance.
- GitHub Copilot: An AI pair programmer that assists developers with code completion, generation, and understanding.
- Autonomous Agents: AI agents that can independently perform tasks, such as code analysis, transformation, and testing.
- Semantic Kernel SDK: A Microsoft SDK for building intelligent agents and orchestrating AI workflows.
- Legacy Code: Older codebases that are difficult to understand, maintain, and modernize.
- Code Preparation: Steps taken to make legacy code more understandable for AI, including reverse engineering, removing irrelevant information, and translating comments.
- Code Enrichment: Adding comments and structure to code to improve its readability and understanding.
- Automation Aids: Tools and techniques to automate tasks such as call chain analysis and test generation.
- Call Chain Structure: The network of function calls within a program, showing how different parts of the code interact.
- TDD (Test-Driven Development): A software development process where tests are written before the code itself.
- Utility Classes: Reusable code modules that perform common tasks, such as date and time manipulation.
- Multi-Agent Orchestration: Coordinating multiple AI agents to work together on a complex task.
- Token Limit: The maximum amount of text that an AI model can process at one time.
AI-Powered Modernization of COBOL
Introduction
Andrea Griffiths from GitHub introduces Julia Cordic, a software global black belt at Microsoft, to discuss AI-powered modernization of legacy COBOL systems using GitHub Copilot and autonomous agents. The goal is to address the challenge of modernizing critical systems written in COBOL, a 65-year-old language, given the scarcity of COBOL developers.
What are Microsoft Black Belts?
Microsoft global black belts are subject matter experts in specific fields, such as software engineering, DevOps, and AI-assisted coding. Julia's expertise lies in helping large organizations accelerate their developer workflows through platform engineering.
The Problem with Legacy Code
Julia and her colleague Gustaf explored how AI could improve mainframe modernization, which is traditionally done manually by developers with COBOL expertise. The existing auto-generated code often lacks human readability and is difficult to maintain.
Three Steps to Modernization
Julia outlines a three-step process for modernizing legacy code:
- Code Preparation:
- Reverse Engineering: Understanding what the code actually does by combining information from the code itself, subject matter experts, technical documentation, and user feedback. GitHub Copilot can assist with this by analyzing the code and extracting business logic.
- Example: Using a reverse engineering prompt to extract the business logic of COBOL files, including technical documentation, comments, and user handbooks, and writing the results in Markdown files.
- Removing Irrelevant Information: Eliminating unnecessary elements like old versioning logs or trivial comments to reduce the token load on the AI.
- Translation: Translating comments and code from languages other than English (e.g., Danish, German) to improve AI comprehension.
- Reverse Engineering: Understanding what the code actually does by combining information from the code itself, subject matter experts, technical documentation, and user feedback. GitHub Copilot can assist with this by analyzing the code and extracting business logic.
- Code Enrichment:
- Adding comments to the code to improve its understanding.
- Leveraging deterministic structures in COBOL (e.g., comments with stars, section keywords) to help the AI chunk and understand the code.
- Automation Aids:
- Call Chain Analysis: Generating a call chain hierarchy to visualize the relationships between different files and subprograms. This can be done by creating a Mermaid diagram.
- Test Generation: Using a TDD approach to generate Java tests based on the extracted business logic before generating the Java code itself.
- Utility Class Identification: Identifying and replacing custom utility classes with standard libraries or third-party dependencies to reduce the amount of code that needs to be considered.
Demonstration of GitHub Copilot Agent Mode
Julia demonstrates how GitHub Copilot Agent Mode can be used to analyze COBOL code and generate a Markdown file with the results. The agent analyzes the code, identifies the different COBOL files, assesses their complexity, and attempts to understand their business purpose. It also generates a Mermaid diagram of the code structure.
Multi-Agent Orchestration with Semantic Kernel SDK
Julia introduces a project developed with bank data using Microsoft's Semantic Kernel SDK for multi-agent orchestration. The goal is to create a framework that can translate code from any source language to any target language, depending on the prompting of the agents.
- Framework Details:
- The framework uses Azure OpenAI endpoints or other AI endpoints.
- It was initially tested with GPT-4 but later found that GPT-4-1 and smaller models like GPT-3 or GPT-1 mini were more efficient.
- The framework includes a "doctor" script to check the configuration and dependencies.
- It generates Java Quarkus code from COBOL source files.
- The process is transparent, showing which agent is working, how many tokens are being used, and the estimated cost.
- Agent Prompting:
- The agents are given system prompts that define their roles and responsibilities.
- The prompts include step-by-step instructions for how to analyze and transform the code.
- The framework includes a "sanitize COBOL" function to perform code preparation steps.
- Customization:
- The framework can be customized to handle different COBOL dialects and target languages.
- The agent prompts can be adjusted to suit the specific needs of the project.
Security Considerations
When using LLMs hosted in the cloud, data is sent to the model. For sensitive data, organizations can host their own LLMs on their own infrastructure and use the framework against their own endpoint.
Cloud Platform Considerations
While the demonstration uses Azure, the framework can be used with other cloud platforms, such as AWS. The choice of platform depends on the organization's existing infrastructure and preferences.
Modernization vs Code Extensions
There are VS Code extensions for modernization that are based on modernization rules that we already know. The difference here is we have no idea what we actually have to do, so every COBOL code is different and complex.
Call to Action
Julia encourages viewers to:
- Explore the open-source repository: aka.ms/ccobalt
- Read the blog article: aka.ms/ccobaltminosblog
- Contribute to the project by forking the repository and submitting pull requests.
- Reach out to Julia and Gustaf on LinkedIn or through their Microsoft account managers to discuss potential collaborations.
Conclusion
AI-powered modernization offers a promising approach to addressing the challenges of legacy COBOL systems. By combining tools like GitHub Copilot and autonomous agents with careful code preparation and human expertise, organizations can modernize their critical systems while maintaining control over the process. The key is to understand the limitations of AI and to use it as a tool to augment, rather than replace, human expertise.
AI summaries can miss context or contain errors. Check important details against the original video.