In Java it's perfectly legal for an interface to extend an interface. Does this relationship in UML look like an "extends" relationship (solid line, closed, unfilled arrowhead) or an "implements" relationship (dotted line, close, unfilled arrowhead)? I can't seem to find an example of this relationship either online or in Fowler's book.
1 Answer
Use "extends" (solid line, closed, unfilled arrowhead), which is consistent with how Java uses the extends
and implements
keywords.
- "extends" == UML generalization / specialization relationship
- "implements" == UML realization relationship
The sub-interface is a specialization of the super-interface, not a realization of it.
See http://www.informit.com/articles/article.aspx?p=29224&seqNum=2
.
-
5
-
@Gabriel - heh - it is a nice diagram. I wish I could take credit for it, but its from the referenced article, so credit to Stephen R. Palmer.– Bert FCommented Apr 23, 2010 at 13:11
-
4@Bert F I was trying to hint at the diamond inheritance problem:) Commented Apr 23, 2010 at 13:15
-
@Gabriel - lol - I'm dense. Doesn't apply to Java interfaces though, right?– Bert FCommented Apr 23, 2010 at 13:34
-
@Bert F I was not sure myself, according to this: <a href="java.sun.com/docs/books/jls/second_edition/html/… Ambiguous Inherited Fields</a> it is a problem, which at least gets resolved at compile time. But I have no idea if this holds for methods. Commented Apr 23, 2010 at 13:40