Programmers increasingly rely on Large Language Models (LLMs) for code generation. However, they now have to deal with issues like having to constantly switch between generating and verifying code, caused by misalignment between programmers' prompts and the generated code. Unfortunately, current LLM-driven code assistants provide insufficient support during the prompt authoring process to help programmers tackle these challenges emerging from the new workflow. To address these challenges, we employed an iterative design process to understand programmers' strategies when programming with LLMs. Based on our findings, we developed CoLadder, a system that assists programmers by enabling hierarchical task decomposition, incremental code generation, and verification of results during prompt authoring. A user study with 12 experienced programmers showed that CoLadder is effective in helping programmers externalize their mental models flexibly, improving their ability to navigate and edit code across various abstraction levels, from initial intent to final code implementation.
翻译:程序员越来越依赖大型语言模型(LLMs)进行代码生成。然而,由于程序员提示词与生成代码之间不匹配,他们现在必须应对诸如不断在生成和验证代码之间切换等问题。不幸的是,当前的LLM驱动代码助手在提示编写过程中提供的支持不足,无法帮助程序员应对这些由新工作流带来的挑战。为解决这些问题,我们采用迭代设计流程来理解程序员使用LLM编程时的策略。基于我们的发现,我们开发了CoLadder系统,该系统通过支持分层任务分解、增量代码生成以及在提示编写过程中验证结果来协助程序员。对12名经验丰富的程序员进行的用户研究表明,CoLadder能有效帮助程序员灵活外化其心智模型,提升他们在从最初意图到最终代码实现的多个抽象层间导航和编辑代码的能力。