Dies ist eine Übersichtsseite mit Metadaten zu dieser wissenschaftlichen Arbeit. Der vollständige Artikel ist beim Verlag verfügbar.
Unlocking Code Simplicity: The Role of Prompt Patterns in Managing LLM Code Complexity
1
Zitationen
5
Autoren
2025
Jahr
Abstract
The rapid growth of generative artificial intelligence, especially Large Language Models (LLMs), has greatly influenced software engineering by automating code generation tasks. Despite the potential, challenges in code maintainability and quality persist, mainly due to prompt design. This study examines how various prompt patterns influence the complexity of Python code generated by LLMs, using the Dev-Gpt dataset. Four prompt patterns were analyzed: Zero-Shot, Few-Shot, Chain-Of-Thought, and Personas. Complexity metrics assessed include Lines of Code (LOC), Cyclomatic Complexity, and Halstead metrics, with statistical analyses conducted using the Kruskal-Wallis test and post-hoc pairwise comparisons. Results showed significant differences in LOC and related sub-metrics among these prompt patterns. Notably, the Chain-Of-Thought pattern consistently generated more concise and efficient code, offering strategies to enhance LLM-generated code quality and maintainability.