Programmers increasingly rely on Large Language Models (LLMs) for code generation. However, misalignment between programmers' goals and generated code complicates the code evaluation process and demands frequent switching between prompt authoring and code evaluation. Yet, current LLM-driven code assistants lack sufficient scaffolding to help programmers format intentions from their overarching goals, a crucial step before translating these intentions into natural language prompts. To address this gap, we adopted an iterative design process to gain insights into programmers' strategies when using LLMs for programming. Building on our findings, we created CoLadder, a system that supports programmers by facilitating hierarchical task decomposition, direct code segment manipulation, and result evaluation during prompt authoring. A user study with 12 experienced programmers showed that CoLadder is effective in helping programmers externalize their problem-solving intentions flexibly, improving their ability to evaluate and modify code across various abstraction levels, from goal to final code implementation.
翻译:程序员越来越依赖大语言模型(LLMs)进行代码生成。然而,程序员目标与生成代码之间的错位使得代码评估过程复杂化,并迫使他们在提示编写与代码评估之间频繁切换。当前基于LLM的代码助手缺乏足够的支架支持,帮助程序员从总体目标中格式化意图——这是将这些意图转化为自然语言提示前的关键步骤。为填补这一空白,我们采用迭代设计流程,深入洞察程序员使用LLM编程时的策略。基于研究发现,我们构建了CoLadder系统,该系统通过促进分层任务分解、直接代码片段操作以及提示编写过程中的结果评估来支持程序员。一项对12名经验丰富程序员的用户研究表明,CoLadder能有效帮助程序员灵活外化问题解决意图,提升其在从目标到最终代码实现的不同抽象层级上评估与修改代码的能力。