Anton Wagner
Anton Wagner

Reputation: 19

Which design patterns are used in this example?

The following example is an older exam question I am trying to understand. The question is: Which design patterns are used in the following class chart?

Class Chart

In my opinion there is the composite pattern:

and the decorator pattern:

However, this class chart looks very strange to me and it's hard to actually understand, whether I am right with those two patterns and, whether there are more patterns I don't see.

Upvotes: 1

Views: 731

Answers (1)

qwerty_so
qwerty_so

Reputation: 36313

No. that's (sorry) just rubbish.

Looking at the shared aggregation UML 2.5 says on p. 110:

Indicates that the Property has shared aggregation semantics. Precise semantics of shared aggregation varies by application area and modeler.

So, it has no semantics at all. For the fun of it, let's assume the author meant a composite here:

Indicates that the Property is aggregated compositely, i.e., the composite object has responsibility for the existence and storage of the composed objects (see the definition of parts in 11.2.3).

Does not make it better. How can specialized cars composite a general one? Is it that they have a couple in their trunk in case the motor fails?

Not going into details with those strange (behavior?) texts below/aside the classes.

Where ever you got this diagram from: send it back with good wishes ;-)

Upvotes: 3

Related Questions