UML Designer User's Guide


Retrieving a protocol

We now have a Borrower class design, which shows the methods defined by the LibraryPatron class. We can now perform some more reverse engineering and retrieve a protocol from the class design. This can be valuable when modeling an existing system; it makes it possible to formally type the parameters and return values of a class and identify which common interfaces it supports. This can help you find methods that do not accept or return the correct types. For a given class, only some of its methods make up its public API, and these might be grouped into one or more protocols to which the class conforms. You can designate one protocol as its main protocol--the one defining the methods making up the primary function of the class.

You can retrieve protocols from any class, even one that is not attached to a class design. When you retrieve a protocol from a class, you can select which method categories are included. In the retrieved protocol, UML Designer will create a message specification for each method in the selected categories.

To retrieve a protocol from the methods of the LibraryPatron class, follow these steps:

  1. In the Class Diagrammer, select the Borrower class figure.
  2. Select Transforms>Retrieve Protocol from the pop-up menu.
  3. In the next window, select the category or categories of the methods you want to retrieve into the protocol. Select And Categories if you want to retrieve only the methods that are in all the selected categories; select Or Categories if you want to retrieve all of the methods that are in any of the selected categories.

    In the Borrower class, the methods are not categorized, so select Not categorized.

  4. For now, you can accept the defaults in the other fields in the window. These fields enable you to control the details of how the methods are retrieved into the protocol:
  5. Select OK to retrieve the protocol.

When UML Designer retrieves a protocol from an existing class design, it automatically creates a "conforms" link between the class design and the retrieved protocol. However, this link does not automatically appear in a class diagram. If you go back to the Class Diagrammer, you can use Hide/Show Relationships to make this conformance link visible.
Reverse engineering illustration (2)


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]