Templates


A template is a descriptor for a model element that has one or more formal parameters ‚ basically, placeholders ‚ that can be used to create a family of related model elements. You create a member of this family by binding actual parameters to the template's formal parameters. (The result of a binding is called a bound element. )

Within Figure 10-3, the Wish class is created via a binding to the Wish List template class.


Figure 10-3: Binding

The dependency has the effect of creating a new Wish class that accepts Holiday customers (those who only make purchases at holiday time) who buy CDs (as opposed to books).

A package can also be bound to one or more template packages. Figure 10-4 shows an example of a bound package, which uses the elements that the package contains as its actual parameters.


Figure 10-4: Bound package

The result of this binding is that the Shopping package contains Servlets named Login (the data entry page), Shopping Cart View (the page on which the Customer makes necessary edits), and Purchasing (a page hidden from Customers on which the Purchasing department does analysis related to Customer purchasing patterns).

Figure 1-22 (see Chapter 1) shows an example of a bound collaboration, which uses classes as its actual parameters. Figure 10-5 shows an alternate notation for this collaboration.


Figure 10-5: Bound collaboration



Fast Track Uml 2.0
Fast Track UML 2.0
ISBN: 1590593200
EAN: 2147483647
Year: 2004
Pages: 97

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net