質問

In a UML component diagram I want to show two components (among others). One is the core component that loads contents (classes) from the other. It's much like a testframework loading unit tests/test discovery. For this I currently have a simple association relationship (which I guess is wrong). Also the loaded component can implement interfaces contained in the core component. For this I currently have a realization relationship between the two.

For plugin architectures I have seen assembly relationships where the core uses functionality provided by the plugins. This seems wrong too, since the core does not necessarily call methods of an interface implementation (at least on this level, I think its a technical detail how the core performs the actual call).

  • How do I show this kind of relationship?
  • Is it good to show two relationships, one for the loading and one for the interface realization?

Edit: adding diagram and more explanation

Components

Core defines two interfaces, that Loaded Components classes can depend on (served via injection). This is shown using B and C arrows. Arrow A shows the realization where a class in Loaded Component can implement an interface from Core.

  • How can I show the loading aspect?
  • Should I show B and C with only one arrow since on this component level this detail is not yet relevant or should I avoid leaving out information here?

Alternatively I could show something like this:

Components2

Core just uses the loaded component to do stuff, Loaded Component depends on interfaces from Core. I can show how it's optional using the suggestions from @qwerty_so 's answer.

役に立ちましたか?

解決

Your first diagram is not correct. Arrow A would mean that Loaded Component implements Core, but this is not true. Classes in Loaded Component may implement interfaces in Core, but because you don't want to explicitly show the classes nor the interfaces, the realization relationship cannot be shown either at this level of abstraction.

The arrows B and C are redundant. A component depends on another component or not, but it cannot depend twice.

The second diagram is correct. Core uses Loaded Component and Loaded Component depends on Core, because without Core, it wouldn't have the interfaces it needs.

UML does not have a specific notation to show that Core loads the other component. You may insert a note symbol in which you explain this in plain English.

他のヒント

I guess it would be enough to attach an {optional} constraint to the realization. If this is some kind of stub to load dynamic interface you eventually don't want to show them all but just some "abstract" interface. It really depends on who your audience is. So eventually it would be ok to have a lollipop appearing at the component and attach a note like "This interface will depend on <whatever configuration> and it's dynamically loaded".

YMMV

ライセンス: CC-BY-SA帰属
所属していません softwareengineering.stackexchange
scroll top