TheFogger
TheFogger

Reputation: 2429

Interface Aggregation in UML Class Diagrams

does one usually put aggregating associations between interfaces?

Example:

Example Diagram

Here, I feel that one aggregation is redundant. The one between the interfaces is more important, because that's what the clients of the classes will be using. BMW and LuxuryWheel will always be used through ICar and IWheel. However, ICar does not really aggregate IWheel, as it is an interface and contains no actual logic. BMW does clearly aggregate LuxuryWheel but that is almost an implementation detail.

How would you model this? Is there a way in UML to mark an aggregation (or association) as abstract, or to-be-implemented?

Upvotes: 10

Views: 8736

Answers (1)

Volker Stolz
Volker Stolz

Reputation: 7402

If you look at the UML spec, you'll find that in 7.3.24:

In particular, an association between interfaces implies that a conforming association must exist between implementations of the interfaces.

So, yes, you can draw aggregations between interfaces, but your diagram may not exactly mean what you expect.

Upvotes: 10

Related Questions