The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Sun Raj:
The class here knows about the colleague classes but does not contain instances of the ccolleague classes.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Sun Raj:
I have the following situation:
There is a tax info interface.
Different states implement this interface.
There about 50 classes that implement this interface.
The new requirement is to implement a class that instantiates one or more of these
(based on some settings) and display tax information of each of the selected states.
Will this be called a mediator pattern or an adapter pattern?
The reason I have this doubt is that like Mediator the new class mediates on behalf of the client and
the colleague classes. It does add new functionality.
But unlike classic definition of Mediator does not have a separate interface but does implement the same
interface as the colleague. The constructor takes a list of selected states.
The reason I think is an adapter is that it is one more implementation of the interface by adapting the user
data to call various objects and collecting and formatting the output from various objects
so that the user sees it as one unit.
Originally posted by Ryan McGuire:
I wouldn't call it either a Mediator or Adapter pattern. You aren't encapsulating how the client object interacts with the various possible concrete implementations of the interface. In fact, once a particular implementation is instantiated, there's no intermediary object between the client object and the concrete TaxInfo implementors, so I wouldn't call it either a Structural or Behavioral pattern (to use the GoF parlance) at all. ...
I don't think it is a Composite. The class here knows about the colleague classes but does not contain instances of the ccolleague classes.
Originally posted by Sun Raj:
Ryan,
Thanks for your reply.
...
Please clarify the following:
Are Composite and Mediator/Adapter mutually exclusive?
Originally posted by Robert Hayes:
A good example of what Ryan is talking about (ie: intent) would be Adapter vs Decorator vs Facade.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Ilja Preuss:
A better example might be Decorator vs. Proxy or Strategy vs. State.
today's feeble attempt to support the empire
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|