Re: How to express conditional dependency between components in UML?



Responding to Riipinen...

How would one express a conditional dependency between two components in UML (2.0) component diagram?

This is the situation: Component A (an executable) uses Component B (a DLL) by dynamically instantiating a class from it but only if certain programmatic parameter, PAR1, is set to value TRUE. The value of the parameter is stored into an .ini-file that is read by Component A on startup. If PAR1 is FALSE or missing, Component A doesn't need Component B at all. There is no static reference from Component A to Component B, everything is done dynamically.

Why use a dependency at all?

    *              0..1
[A] ------------------- [B]

When an [A] is created the factory can look up PAR1 and instantiate the association as needed. IMO that does the best job of encapsulating the relevant policy. [I am somewhat biased because dependencies are not part of the MDA profile that I use. B-)]

Alternately, you can attach an OCL constraint to the dependency to explicitly show the effect of PAR1.


************* There is nothing wrong with me that could not be cured by a capful of Drano.

H. S. Lahman
hsl@xxxxxxxxxxxxxxxxx
Pathfinder Solutions  -- Put MDA to Work
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
(888)OOA-PATH



.