This link is a paper detailing “Product Trader Pattern”
Does anyone have some experiences to share with this? Links to some example code?
I’d love to see some implementation examples in C# in particular.
Two issues are confusing me:
(1) the creation of a product. can someone translate the example code in the paper (below) into c#
(2) is the specification class the same as the Specification Pattern advocated by Evans and Fowler?
Cheers,
Berryl
template<class ProductType, class SpecType>
class Creator
{
public:
Creator(SpecType aSpec) : _aSpecification(aSpec) {}
SpecType getSpecification() { return _aSpecification; }
ProductType * create() = 0;
private:
SpecType _aSpecification;
};
template<class ProductType, class ConcreteProductType, class SpecType>
class ConcreteCreator : public Creator<ProductType, SpecType>
{
public:
ConcreteCreator(SpecType aSpec) : Creator<ProductType, SpecType>(aSpec) {}
ProductType * create() { return new ConcreteProductType; }
}
Here is a translation of the code in C#: