File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Notations for UML interfaces

 
James Chegwidden
Author
Ranch Hand
Posts: 201
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
B.Sathish
Ranch Hand
Posts: 372
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Hope this clarifies.
 
B.Sathish
Ranch Hand
Posts: 372
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I meant << >> and not < >
 
Scott Ambler
author
Ranch Hand
Posts: 608
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The abstract constraint would be incorrect.

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.

I have examples of modeling interfaces at http://www.agilemodeling.com/style/interface.htm if you're interested.

- Scott
 
James Chegwidden
Author
Ranch Hand
Posts: 201
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

JC
 
Dave Wood
bronco
Ranch Hand
Posts: 161
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While it would seem logical (IMHO) for the operation names to be in italics, they are not supposed to be.
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Scott Ambler
author
Ranch Hand
Posts: 608
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 201
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 608
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

- Scott
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic