Interfaces in UML component diagram

2019-08-07 08:05发布

In the UML class diagram the interface is equivalent to the interface concept in programming languages (a set of methods that the class that implement the interface should implement). I want to know if the interface in the component diagram has the same meaning. Are the interfaces mentioned in the component diagram the same interfaces that are detailed in the class diagram or should I treat every method in the component diagram as a separate interface?

标签: oop uml
1条回答
We Are One
2楼-- · 2019-08-07 08:41

There is actually no real difference between both. You can realize an interface with a class as well as with a component. Also you can show the realization in both cases with the socket/lollipop notation.

Components are not much different to classes. You can think of a component as a container that hosts a number of different classes. And if one of those classes realizes an interface you can expose that through the component (if you so wish). Additionally a component can have a lot of internal interfaces for its hosted classes.

查看更多
登录 后发表回答