包图中依赖和import/access的区别

Difference between dependency and import/access in package diagram

我认为导入和访问是依赖类型,但有一个网站说它们不是。它说依赖关系与 import/access 关系有点不同。 有什么区别?提前致谢。

依赖关系

A Dependency implies that the semantics of the clients are not complete without the suppliers. The presence of Dependency relationships in a model does not have any runtime semantic implications. The semantics are all given in terms of the NamedElements that participate in the relationship, not in terms of their instances.

PackageImport

A PackageImport is a DirectedRelationship between an importing Namespace and a Package, indicating that the importing Namespace adds the names of the members of the Package to its own Namespace.

PackageMerge

A PackageMerge is a directed relationship between two Packages that indicates that the contents of the target mergedPackage are combined into the source receivingPackage according to a set of rules defined below. It is very similar to Generalization in the sense that the source element conceptually adds the characteristics of the target element to its own characteristics resulting in an element that combines the characteristics of both.


依赖声明它没有任何运行时语义含义;这对所有子类都必须保持正确(子类不能放松约束)。所以如果 PackageImport 是 Dependency 的子类,那么它就不能导入任何东西。

过于简单化:依赖捕捉一个想法(例如这个包«使用»另一个包,但我们不关心如何),而 PackageImport 捕捉一个动作(例如这个包«导入»另一个包与这些精确的机制)。

作为旁注,它们确实以 DirectedRelationship 的形式共享一个共同的祖先