一句话:提出面向测试的编程(TOP)范式,开发者只需审查由自然语言规约生成的测试代码,生产代码交由 LLM 生成。
大语言模型(LLM)已展现出强大的代码生成能力,现有工具主要依赖自动补全助手或多智能体编排来辅助开发者编程,开发者仍需深度介入生产代码的编写。本文提出一种更高抽象层次的编程范式——面向测试的编程(Test-Oriented Programming, TOP):开发者只负责检查依据自然语言规约生成的测试代码,而生产代码则可委托给 LLM。为评估该设想的可行性,作者实现了一个概念验证工具,并用两个不同的 LLM 生成一个小型命令行程序。实验取得了初步的积极结果,同时也识别出将该范式应用于真实项目时所面临的若干挑战。
Large language models (LLMs) have shown astonishing capability of generating software code, leading to its use to support developers in programming. Proposed tools have relied either on assistants for improved auto-complete or multi-agents, in which different model instances are orchestrated to perform parts of a problem to reach a complete solution. We argue that LLMs can enable a higher-level of abstraction, a new paradigm we called Test-Oriented Programming (TOP). Within this paradigm, developers only have to check test code generated based on natural language specifications, rather than focusing on production code, which could be delegated to the LLMs. To evaluate the feasibility of this proposal, we developed a proof-of-concept tool and used it to generate a small command-line program employing two different LLMs. We obtained promising results and identified challenges for the use of this paradigm for real projects.