The examples for conveying a concept are rarely effective at showing the power of the concept. (E.g. A factory that simply wraps new MyType();).
And the examples that show how powerful a concept can be (e.g. A factory that demonstrates the provider/strategy pattern) is rarely effective for demonstrating the concept of a factory at its purest level.
My own experience is that simple factories aren't good for much except demonstrating what a factory is. But factories tend to be where the "magic" part of a design pattern is implemented. (Strategy, Decorator, and even Visitor, are all built on Factory.)
I think we’re in agreement that factories are useful. My only point is that modern C# can accomplish the same thing using functional programming instead of OO classes.
(The GoF book was written before mainstream OO languages supported functional programming.)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The examples for conveying a concept are rarely effective at showing the power of the concept. (E.g. A factory that simply wraps
new MyType();
).And the examples that show how powerful a concept can be (e.g. A factory that demonstrates the provider/strategy pattern) is rarely effective for demonstrating the concept of a factory at its purest level.
My own experience is that simple factories aren't good for much except demonstrating what a factory is. But factories tend to be where the "magic" part of a design pattern is implemented. (Strategy, Decorator, and even Visitor, are all built on Factory.)
I think we’re in agreement that factories are useful. My only point is that modern C# can accomplish the same thing using functional programming instead of OO classes.
(The GoF book was written before mainstream OO languages supported functional programming.)