MaintainCoder:动态需求下的可维护代码生成
MaintainCoder: Maintainable Code Generation Under Dynamic Requirements
AI总结:
针对动态需求下代码可维护性不足的问题,本文提出融合 Waterfall、设计模式与多智能体协作的 MaintainCoder,并构建含需求变更和动态维护指标的基准,实验显示其动态可维护性提升超 60%。
摘要:
现代代码生成在功能正确性和执行效率方面已取得显著进展。然而,这些系统往往忽视了现实软件开发中的一个关键维度:可维护性。为了以最少返工处理动态需求,我们提出 MaintainCoder 这一开创性解决方案。它融合 Waterfall 模型、设计模式和多智能体协作,系统性地增强内聚、降低耦合,从而实现清晰的职责边界和更好的可维护性。我们还引入了 MaintainCoder 基准,该基准包含需求变更以及关于维护工作量的新型动态指标。实验表明,当需求演进时,现有代码生成方法难以达到可维护性标准。相比之下,MaintainCoder 将动态可维护性指标提升了 60% 以上,同时初始代码的正确性甚至更高。此外,尽管静态指标无法准确反映可维护性,甚至彼此矛盾,但我们提出的动态指标表现出高度一致性。我们的工作不仅为可维护代码生成奠定了基础,也强调了开展更真实、更全面的代码生成研究的必要性。资源:https://github.com/IAAR-Shanghai/MaintainCoder。
英文摘要:
Modern code generation has made significant strides in functional correctness and execution efficiency. However, these systems often overlook a critical dimension in real-world software development: maintainability. To handle dynamic requirements with minimal rework, we propose MaintainCoder as a pioneering solution. It integrates the Waterfall model, design patterns, and multi-agent collaboration to systematically enhance cohesion, reduce coupling, achieving clear responsibility boundaries and better maintainability. We also introduce MaintainCoder, a benchmark comprising requirement changes and novel dynamic metrics on maintenance efforts. Experiments demonstrate that existing code generation methods struggle to meet maintainability standards when requirements evolve. In contrast, MaintainCoder improves dynamic maintainability metrics by more than 60% with even higher correctness of initial codes. Furthermore, while static metrics fail to accurately reflect maintainability and even contradict each other, our proposed dynamic metrics exhibit high consistency. Our work not only provides the foundation for maintainable code generation, but also highlights the need for more realistic and comprehensive code generation research. Resources: https://github.com/IAAR-Shanghai/MaintainCoder.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。