评估 UML class 图

Assessing an UML class diagram

假设我绘制了一个 UML class 图来表示我项目的 class 和界面结构。在实际创建那些 classes 和接口之前,是否有任何方法可以评估 UML 设计?

例子:已知下图会导致菱形问题。并且必须更改或处理。

UML 是一种强大的设计语言。它独立于编程语言(尽管它偏向于基于 class 的语言),因此允许设计在某些语言中无法实现但在某些其他语言中微不足道的东西。

真正的问题是您对评估的期望:

  • 模型在符合 UML 规范方面的语法和语义有效性?在你的图中,你使用 void 类型,它不属于 UML 的原始类型。这是一种依赖于语言的类型。
  • 模型的完整性和准确性,并注意潜在的歧义和缺失信息?例如,在您的图表中,Animal.eats() 可能是 {abstract}。但是缺少这些信息是否表明它不是抽象的?
  • 评估class设计,例如其复杂性、继承的深度、关系的强度、相互依赖性等... ?但是,当某些领域天生就很复杂时,这如何帮助发现糟糕的设计呢?
  • 可行性UML allows for multiple inheritance, but does not precisely define the semantics behind it. For instance, in C++ you can very well cope with this design with the virtual inheritance of Animal. In Java, multiple inheritance is forbidden and this would not be implementable as such (you would need to alter this model to introduce an interface and use interface realization). Now here, we will not reopen the debate about MI.

这里每天都会对图表进行系统的复习。此类评估的目标是查看符号是否与 UML 规范一致,并最终与探索此类一致性评估自动化的所选 UML profile. There are some research papers 的约束一致。

设计目前自动化程度不高;因此,据我所知,没有系统的方法来评估设计。

有一些通用指标(例如 CK metrics) and some of these can be calculated for UML class 图表(例如 6 个 CK 指标中只有 3 个)。指标不是评估,但它们可以帮助分析师完成此任务.