• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Notations for UML interfaces

 
Author
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry I meant << >> and not < >
 
author
Posts: 608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
bronco
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic