Exercise 7: Reapplying the pattern

This exercise explores reapplying the sample pattern after adding additional elements to an interface you will use as an argument.

In exercise 6, you specified arguments for the Interface pattern. You saw that UML operations were added to the class AppFunction1 when you specified AppFunction1 as an argument, and it was bound to the assigned template parameter. Now you can modify some of the argument elements to observe how you can use reapplying patterns to update the other elements that participated in the pattern application.

If you would like to view this exercise before you perform the steps, click:

 Show me button Show Me

Before you begin, you must complete Exercise 6: Binding existing elements as arguments.

Adding an operation to an interface

So that you can see the power of using pattern, add an operation element to observe the results of reapplying the pattern.
  1. In the Model Explorer view, right-click IMyInterface interface and click Add UML > Operation. An operation is added to the interface and the default name is in focus.
  2. Type myOperation over the default name.
  3. In the diagram view, right-click the right-click the pattern instance and click Patterns > Reapply Pattern. Unless the pattern author specifically alters the reapply process, all of the bound elements, as with this pattern, are now re evaluated by the pattern.
  4. In the diagram view or in the Model Explorer view, locate the AppFunction1 class to observe the results of the reapplication of the pattern. The myOperation operation was added to IMyInterface.

Finish this tutorial by reviewing the materials in the Apply a pattern summary.

Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.