2

I'm under confuse with the Component - Subcomponent relationship and Generalization relationship between the components.

When do we need to mention two components as Component - Subcomponent relationship and when to mention them as Generalization relationship.

Can the Generalization relationship (Figure A) be mentioned as the Component - Subcomponent relationship (Figure B) within in Component Diagrams in all the time? (It is understandable that inverse is false)

Figure A :

enter image description here

Figure B :

enter image description here

ironwood
  • 8,936
  • 15
  • 65
  • 114

1 Answers1

2
  • The notation in figure B is used to represent component realization relationship.

    www.omg.org/spec/UML/2.5/Beta2:

    11.6.3 Structured Classifiers → Components → Semantics

    ...A Component may be realized (or implemented) by a number of Classifiers. In that case, a Component owns a set of ComponentRealizations to these Classifiers.

    A component acts like a Package for all model elements that are involved in or related to its definition, which should be either owned or imported explicitly. Typically the Classifiers that realize a Component are owned by it...

  • You can use the generalization relationship (figure A) between components as usual because component is an UML classifier like any other class.

But figure A and figure B represent different things and figure B in your example is not ok

xmojmr
  • 8,073
  • 5
  • 31
  • 54
  • The 2nd figure shows a nesting (sub-components) while the first shows a generalization. So ONE of both is wrong. – qwerty_so Feb 19 '15 at 14:58
  • 1
    @ThomasKilian guessing from the names in OP's example you will not use "Car" and "Hotel" and "Air Conditioning" to implement(realize) a "Service Controller" component and deliver it to the client. They seem to be distinct things, used at different times in different pieces of software at different places. So figure `B` is wrong. They may share some behavior and even code so they may be connected by the generalization relationship, so figure `A` is what OP wanted to express – xmojmr Feb 19 '15 at 15:05
  • Hi xmojmr, Thank you for the answer and the valuable information. So, that means, generally, if component is "owned" by another then we can say there's a component realization relationship between them. Isn't it? – ironwood Feb 20 '15 at 08:55
  • 1
    @Namalak I read the definition this way too. But from the UML metamodel perspective a component can package ("own") another without really needing/using it so there would be no realization. Also `UML Superstructure 2.4.1` says: "_..It should be noted that for the purpose of applications that require multiple different sets of realizations for a single component specification, a set of standard stereotypes are defined in the UML Standard Profile. In particular, «specification» and «realization» are defined there for this purpose.._". If you need to call things _right_, consult the specification – xmojmr Feb 20 '15 at 10:36