Automatic summarization has advanced rapidly, but summarizing software design patterns remains unexplored. We introduce DPS, the first approach to generate natural-language summaries of design patterns directly from code. Using JavaParser, we extract pattern structures into JSON, then apply an NLG library to produce concise, context-aware summaries capturing roles, relationships, and usage intent. Empirical evaluation shows DPS summaries align closely with human-written ones (high ROUGE-L, BLEU-4, NIST, FrugalScore). A developer survey confirms DPS better preserves context than manual summaries. A timed task reveals summaries significantly reduce comprehension time.
翻译:自动摘要技术发展迅速,但针对软件设计模式的摘要生成仍属空白。本文提出DPS,首次实现直接从代码生成设计模式的自然语言摘要。我们利用JavaParser将模式结构解析为JSON格式,随后通过自然语言生成库生成简洁、上下文感知的摘要,涵盖角色定义、关联关系及使用意图。实证评估表明,DPS生成的摘要与人工撰写的摘要高度吻合(在ROUGE-L、BLEU-4、NIST和FrugalScore指标上表现优异)。开发者调研证实,相较于人工摘要,DPS能更好地保持上下文完整性。限时任务实验进一步揭示,该摘要能显著缩短代码理解时间。