Lecture 20: Extended Visitor Design Pattern
Ambient Temperature: 74.1oF
Concepts
- Extended Visitor Design Pattern: Instead of a host calling visitor.this_type_of_host_case(…), the host can call visitor.case_for_host( host_type, parameters… ). This allows your visitor to have a set_case_for_host( host_type, ICase _case ) method that will add behavior to the visitor for the specified host type. The end result is that you can support an arbitrarily large number of hosts that can be set at design-time, compile-time, and/or run-time.
- Make sure to have a”default” command for host types that do not have a specific command mapped to them.
- Lecture 21 (using the extended visitor pattern to implement self-balancing tree data structures) was briefly introduced.
Quotes
Resources
- Lecture 20 Webpage: http://www.clear.rice.edu/comp310/f12/lectures/lec20/
- Demo of Exended Visitors: http://www.clear.rice.edu/comp310/f12/demos/ExtendedVisitorDemo/
- Lecture 21 Webpage: http://www.clear.rice.edu/comp310/f12/lectures/lec21/