What is the correct way to represent template classes using UML?

In a UML diagram, what is the correct way to represent a template class?

+43
templates diagram uml
May 13, '09 at 21:22
source share
2 answers

A regular rectangle with a dashed rectangle in the upper right corner to represent a template parameter. Something like that:

....... ___________: T : | :.....: | | | ClassName | | | |______________| 
+76
May 13, '09 at 21:27
source share

A more useful approach is to use a UML classifier for the template. This is a UML element that represents an extension for UML notation. If your tool supports profiles, create a classifier within one. Define a classifier for the template and include the properties and methods from the template, then instead of using the standard class notation, use the classifier that you created for each class that uses the template. This will be the correct use of UML for templates.

+2
Oct 06 '09 at 0:05
source share



All Articles