UML Designer User's Guide


Attaching a class design to an existing class

For example, suppose we have a new requirement for the library catalog system: we now want to track circulation, keeping records of which patrons have checked out which books. This means we will almost certainly need a class to represent borrowers. We could choose to build a new Borrower class for this purpose; but suppose we then find out that we already have a LibraryPatron class that was implemented for a system that prints library cards. The LibraryPatron class has the following attributes, each with a getter and setter method:

This seems to be everything we need, so now we just need to incorporate the LibraryPatron class into our Library Catalog model. To do so, follow these steps:

  1. Make sure a LibraryPatron class exists in the image. (You can create the class yourself using the standard Smalltalk browsers; just add instance variables and stub getters and setters for the attributes above.)
  2. In the Class Diagrammer, add a new Class figure icon class figure to the drawing surface.
  3. Select Attach from the pop-up menu of the new figure.
  4. When prompted for the class design to link to, type Borrower in the Specify New Item field.
  5. Select New.
  6. In the next window, make sure Link To Real Class is selected.
  7. Specify LibraryPatron in the Class Name field. (The name of the underlying Smalltalk class does not have to be the same as the name of the attached class design.)
  8. Select OK.

The new Borrower class figure should now be automatically populated with the attributes and methods from the existing LibraryPatron class. Since the name of the class design is different from that of the underlying class, the label of the class figure gives both names.
Reverse engineering illustration (1)


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