So is the Delegate pattern concerned with object instantiation? Is it a variant or synonym for the Factory pattern then? I've tried to figure out .NET delegates (which I thought were more related to the Observer pattern though it's not an exact match), or are they completely unrelated to the Delegate pattern?
I've been in situations where I needed to manage different end products so I created a class for each one and then created a factory to encapsulate the decision making code. Then when you need to instantiate an object, you don't do it in plain sight, you call on the factory, pass in your parameters (if any) that tell the factory what kind of object you need, and let the factory worry about instantiation.
My understanding of the Strategy patten was that it allows you to encapsulate a particular behavior that a class has, then compose the behavior into the main class. This gives you the option to build variations of the behavior to 1) define different behaviors for different subclasses and 2)
swap / change behaviors at run time if desired.
__________________
-------------------------
Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe
When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper
Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
|