>new CarFactory(Car);
New CarFactory(Car);
If you don't see a use for the factory pattern, you've never had to do software architecture.
The question is: how often can the factory pattern be replaced by a decent dependency injection library?
Factories are for cars m8, not programming.
System.Technology.Mechanical.Vehicles.Car car = new System.Technology.Mechanical.Vehicles.Car(1, 2, 3, 4)
>m-muh dependency injection
Look kids, it's another buzzword Sup Forums uses but don't understand the meaning of.
Something dynamic with a lot of variations that depend on parameters you pass to the factory. Anything else should be done with DI - much cleaner and more maintainable that way. So the answer to your question is basically always.
Is this from the C#ar library?
God damn I love Go. Look at the perfection below.
car := car.New(1, 2, 3, 4)
What's you problem?
It's not that complicated.