Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In class diagrams, should classes implementing an interface have the method names repeated?

I'm creating some UML diagrams, and I have a large number of classes implementing an interface.

Is it necessary for these classes to also list the methods of the interface? It sounds quite trivial but will make the diagram look much simpler if they do not.

Here is an image to show what I mean:

UML diagram showing a class implementing an interface with the interface's method names repeated in the class
(source: yuml.me)

Any implementation of MyInterface requires method1, method2 and method3 - so can these be left out?

like image 568
Tim MB Avatar asked May 10 '13 09:05

Tim MB


People also ask

How is the interface represented in the class diagram?

Class rectangle symbol that contains the keyword «interface». This notation is also called the internal or class view. Use the class shape when you need to model the details of the interface. Compartments in the class shape display information about the attributes, operations, and signal receptions of the interface.

How do you represent implements in class diagram?

In domain modeling class diagrams, an implements relationship represents a class that implements the operations in a Java™ interface. As the following figure illustrates, an implements relationship is displayed as a dashed line with an unfilled arrowhead.

How is an interface represented in UML?

Interface is represented by a circle as shown in the following figure. It has a name which is generally written below the circle. Interface is used to describe the functionality without implementation.


1 Answers

I often refer to Agile Modeling's class diagramming guidelines. You'll find your question answered in section 3, "Interfaces".

Quick answer: They can be left out.

like image 153
Casper Thule Hansen Avatar answered Sep 22 '22 12:09

Casper Thule Hansen