A froggy visitor

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
(Wiped it out)
Line 1: Line 1:
Should a frog be able to export itself? For those that think not, the [[Visitor|Visitor pattern]] may provide a solution. Figure 1 presents an application of the Visitor pattern structure to the [[Frogs design]], the interactions are described in Fig. 2. Here, the Exporter class and its child play the role of the visitor. The Frog class accepts visits from an Exporter object, then passes itself to the Exporter. The Exporter then performs operations using the Frog object. These operations are captured in the methods
+
Homework excercise for us!
*EggyExportOperation()
+
*TadpoleyExportOperation()
+
*AdultFroggyOperation()
+
Although, an Exporter is more likely to be interested in the attributes of a Frog object.
+
 
+
 
+
[[image:AFroggyVisitorStructure.JPG|frame|centre|'''Figure 1: A [[UML 2.1]] [[Class diagram|class diagram]] describing an application of the Visitor structure to the [[Frogs design]]''']]
+
 
+
 
+
[[image:AFroggyVisitorCommunication.JPG|frame|centre|'''Figure 2: A [[UML 2.1]] [[Communication diagram|communication diagram]] describing an application of the Visitor pattern interactions to the [[Frogs design]]''']]
+
 
+
 
+
==See also==
+
*[[Visitor]]
+

Revision as of 05:02, 15 July 2010

Homework excercise for us!

Personal tools