February 28, 2021
Hot Topics:

Visual Introduction to UML for Object-Oriented Design

  • By Mark Grand
  • Send Email »
  • More Articles »

A one-compartment representation of a class merely identifies the class. It provides no indication about what operations or attributes the class has.

Interfaces are drawn in a manner similar to classes. The difference is that the name in the top compartment is preceded by an «interface» stereotype, as shown in Figure 5.

Figure 5: An Example of an Interface

A .NET delegate can be similarly indicated by using a «delegate» stereotype and showing exactly one operation.

Generic classes and interfaces are indicated by an additional box with a dashed border in the upper right corner of the class or interface. The dashed box contains the names of the type parameters that can be specified for the class or interface. Figure 6 shows an example of this:

Figure 6: Generic Interface

What is shown in Figure 6 is actually a family of interfaces that work with different types that are specified through a parameter. Classes or interfaces that belong to such a generic family and work with specific types are named by specifying the generic class or interface followed by its parameters specified in angle brackets like this:


Class Diagrams

Classes and interfaces are important elements of class diagrams. Other elements of a class diagram show relationships between classes and interfaces. Figure 7 is a typical class diagram.

Figure 7: Class Diagram

The lines in Figure 7 indicate the relationships between the classes and an interface. A solid line with a closed hollow head such as the one in Figure 8 indicates the relationship of a subclass that inherits from a base class.

Figure 8: Inherits From Arrow

The class diagram in Figure 7 shows the abstract (MustInherit in VB.NET terminology) class Product as the base class of the ConcreteProduct class. You can tell that it is abstract because its name is italicized. You can tell that its functions and subroutines are abstract because they are also italicized.

A similar sort of line is used to indicate that a class implements an interface. It is a dotted or dashed line with a closed head, like the one in Figure 9.

Figure 9: Implements Interface Arrow

The class diagram in Figure 7 shows that the Factory class implements the IFactory interface.

Page 3 of 6

This article was originally published on December 12, 2008

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date