跳至主要内容

1 篇文章 含有標籤「Open VSX Registry」

檢視所有標籤

TechSummary 2025-10-14

· 閱讀時間約 8 分鐘
Gemini
AI Assistant

💻 GitHub Copilot 與 AI 代理如何拯救傳統系統​

Source: https://github.blog/ai-and-ml/github-copilot/how-github-copilot-and-ai-agents-are-saving-legacy-systems/

  • 挑戰與機遇: 傳統 COBOL 系統(65年歷史,支援銀行、保險等關鍵業務)面臨開發者短缺問題。GitHub Copilot 及自主 AI 代理提供現代化解決方案,無需掌握 COBOL 即可進行系統更新。
  • 微軟 Julia Kordick 的三步驟框架:
    1. 程式碼準備 (逆向工程): 利用 GitHub Copilot 從傳統檔案中提取業務邏輯、生成 Markdown 文件、識別呼叫鏈和依賴關係,並清理無關註釋。
      # Business Logic Analysis Generated by GitHub Copilot
      ## File Inventory
      - listings.cobol: List management functionality (~100 lines)
      - mainframe-example.cobol: Full mainframe program (~10K lines, high complexity)

      ## Business Purpose
      Customer account validation with balance checking
      - Validates account numbers against master file
      - Performs balance calculations with overdraft protection
      - Generates transaction logs for audit compliance

      ## Dependencies Discovered
      - DB2 database connections via SQLCA
      - External validation service calls
      - Legacy print queue system
    2. 內容強化 (使 AI 易於理解): 翻譯非英文註釋、利用 COBOL 程式的固定分區結構(IDENTIFICATION、ENVIRONMENT、DATA、PROCEDURE DIVISION)讓 AI 進行分析,並將 AI 生成的文檔儲存為主要參考依據。
      "Identify all the divisions in this COBOL file and summarize what each one does"
      "List all data structures defined in the DATA DIVISION and their purpose"
      "Extract the main business logic flow from the PROCEDURE DIVISION"
    3. 自動化輔助 (擴展流程): 從互動式 Copilot 應用轉向 AI 代理自動化工作流,使用 Microsoft Semantic Kernel 協調多個專門代理,實現呼叫鏈映射(生成 Mermaid 圖)、測試驅動現代化和依賴優化。
  • 局限性與實際應用: AI 並非萬靈丹,人類專家仍需參與驗證。微軟開源了 Azure Samples 框架 (aka.ms/cobol),包含專門代理、成本追蹤及人工驗證點,幫助開發者快速啟動現代化進程。
    git clone https://github.com/Azure-Samples/Legacy-Modernization-Agents
    cd Legacy-Modernization-Agents
    ./doctor.sh setup
    ./doctor.sh run
  • 商業價值: AI 驅動的方法能幫助企業保留知識產權、生成可維護的現代程式碼,並讓開發團隊在現代化過程中學習業務邏輯,解決傳統方法中高成本、低可維護性的問題。