1

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.

  • I don't understand the case. You talk about a core component C and another component X that loads classes c1, c2, c3 etc. on behalf of component C. Then you talk about a loaded component. Is that the same as X or the same as c1, c2 or c3? The loaded component may implement zero or more interfaces i1, i2, i3 etc. contained in C. Is there a fixed number of interfaces? Do you mention these individually in the model? Is there a fixed number of classes c1, c2, etc? Do you mention these individually in the model? What happens after a class is loaded?Please share a diagram we can comment on. – www.admiraalit.nl Sep 25 '19 at 20:55
  • Thanks for thinking about it. C is the component that load's X in your terms. The loaded component can implement any number of classes from an interface from C. I don't want to mention these individually in the model. For injected interfaces there is a fixed number of 2. However I am unsure about mentioning both in the model due to the level of abstraction. After loading, the loaded classes are basically a set of instructions that are being run. I added some images and explanation for clarification. Thanks – Phil Sep 26 '19 at 6:38
1

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.

| improve this answer | |
  • Thank you, that clarified a lot for me. One follow-up question: If I model "one layer down" where I show the interfaces and insert ports to the components for the relationships. For each relationship in my incorrect first diagram, do I add ports for each or do all relationship arrows go through one port? Currently my lower level component shows exactly as many ports as it has on the upper layer, which I think is the way to go. But then how can I show the different relationships for the two interfaces? – Phil Sep 26 '19 at 11:02
  • You can have a separate port for each interface, or one port for both: Both is allowed in UML. Your choice depends on how you map ports to technical entities, e.g. you may have the convention that each port maps to a single WSDL. To show the 'realize' relationships, I would recommend to draw a few example classes in the loaded component and relate them to the interfaces. – www.admiraalit.nl Sep 27 '19 at 12:19
1

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.