Modular programming, which aims to construct the final program by integrating smaller, independent building blocks, has been regarded as a desirable practice in software development. However, with the rise of recent code generation agents built upon large language models (LLMs), a question emerges: is this traditional practice equally effective for these new tools? In this work, we assess the impact of modularity in code generation by introducing a novel metric for its quantitative measurement. Surprisingly, unlike conventional wisdom on the topic, we find that modularity is not a core factor for improving the performance of code generation models. We also explore potential explanations for why LLMs do not exhibit a preference for modular code compared to non-modular code.
翻译:模块化编程旨在通过集成更小、独立的构建块来构建最终程序,长期以来被视为软件开发中的理想实践。然而,随着基于大语言模型(LLMs)的代码生成智能体的兴起,一个问题随之产生:这一传统实践对这些新工具是否同样有效?在本研究中,我们通过引入一种新颖的量化度量指标来评估模块化在代码生成中的影响。与关于该主题的传统观点不同,我们意外地发现模块化并非提升代码生成模型性能的核心因素。我们还探讨了LLMs相较于非模块化代码并未表现出对模块化代码偏好的潜在原因。