一句话:首个 Ada 语言 LCOM 实现,并通过 ROSE 编译器工具提供可扩展的 C++/Ada 内聚度量与可视化。
LCOM(方法缺乏内聚度)量化类中方法的内聚程度,高内聚类更易理解和维护,低内聚类可用于指导面向对象软件重构。尽管 LCOM 定义明确,真实语言特性使实际实现复杂。本文提出首个 Ada 语言的 LCOM 实现,并基于 ROSE 编译器工具设计可扩展方案以支持 C++,提供度量与可视化工具。作者讨论实用 LCOM 实现所需的设计决策,在开源代码上分析该方法并与现有工具比较。结果表明,该工具与所评估工具相比具有竞争力,能处理相关工作忽略的边界情况,报告更准确的 LCOM 度量,并以开源许可证发布 ROSE LCOM Tools。
Lack of Cohesion of Methods (LCOM) quantitatively measures the cohesiveness of methods within a class. High cohesiveness indicates a class specialized for a given task, making it easier to understand and maintain. LCOM identifies classes with low cohesion, useful for targeted code refactoring in object-oriented software development. Although LCOM definitions are well-understood, real-world language features complicate practical implementations. In this work, we propose the first known implementation of LCOM for the Ada programming language and use an extendable design via the ROSE compiler tool to provide C++ support as well. In this work, we propose a tool to measure and visualize LCOM for C++ and Ada code. It is the first known implementation of LCOM for the Ada programming language. We evaluate the design decisions needed for a practical LCOM implementation, analyze the approach against open-source code, and compare our analyzer against existing tools. We find that our work is competitive with other evaluated tools while handling edge cases ignored by related works, reporting more accurate LCOM metrics. Finally, we provide a release of our tool, ROSE LCOM Tools, under an open-source license.