I have seen in different books different notations to represent Interfaces in UML class diagrams. Two authors also told me the same. I have tried various sources but which is more common:
<<interface>> Interface Name All methods in italics
or
Interface Name All methods in italics
or <<interface>> Inteface name All methods regular font (no italics)
Input appreciated
JC
Mr. C<br /> <br />Author and Instructor<br />My book:<br /><a href="http://www.aw-bc.com/catalog/academic/product/0,1144,1576761614,00.html" target="_blank" rel="nofollow">http://www.aw-bc.com/catalog/academic/product/0,1144,1576761614,00.html</a>
An interface is considered to be a stereotype in UML. A stereotype is something that is not a core UML construct but similar to one. Thus an interface is a stereotype of a class in UML. Stereotypes are represented by guillemets << >>
<<interface>> Interface Name Operations
You could also use the {abstract} constraint along with / in place of italics.
To model the interface itself the notation would be: ------------------------------ | <<Interface>> | | Inteface name | |----------------------------| | Static attributes (if any) | |----------------------------- | Methods | ------------------------------
In the UML the stereotype is placed in the wrong position, IMHO. It should actually appear below the interface name, not above it, because the name is more important than the stereotype.
Scott, I saw your site. is the interfaces with the guillmets. Are the methods in italics (since with interfaces they are automatically abstract) I cannot tell from you written diagram.
Also, what about the convention of putting the letter I with the interface name- IClassName.
Originally posted by Scott Ambler: In the UML the stereotype is placed in the wrong position, IMHO. It should actually appear below the interface name, not above it, because the name is more important than the stereotype.
You can't help but wonder if the stereotypical (sic) placement of the stereotype has more to do with some VB GUI code written by a summer intern at Rational once upon a time than for any more rational (sic x 2) reason.
Reid - SCJP2 (April 2002)
Scott Ambler
author
Ranch Hand
Joined: Dec 12, 2003
Posts: 608
posted
0
Italics: No.
The I naming convention is common in the Microsoft world, but in Java generally not.
You can't help but wonder if the stereotypical (sic) placement of the stereotype has more to do with some VB GUI code written by a summer intern at Rational once upon a time than for any more rational (sic x 2) reason.
Perhaps. I think that it's because: 1. The OMG contributors didn't have a handle on basic HCI stuff. 2. They were so excited about the concept of stereotypes at the time they thought that everyone else would be, so they put them first.
- Scott
James Chegwidden
Author
Ranch Hand
Joined: Oct 06, 2002
Posts: 201
posted
0
Scott, Is your book published through a major texbook publisher. I may adopt it for my Java C++ online course in the fall. Will have to get an exam copy..
JC
Scott Ambler
author
Ranch Hand
Joined: Dec 12, 2003
Posts: 608
posted
0
The Object Primer 3rd Ed is likely your best bet, and it's published by Cambridge University Press (CUP). My other books are published by various publishers, including CUP, Wiley, and Addison Wesley.