4 ms·
In OOP, a factory is a pretty common design pattern, and I'm a bit surprised you've never seen it in 15 years of software development... considering it's taught
by opmac 9y ago
In OOP, a factory is a pretty common design pattern, and I'm a bit surprised you've never seen it in 15 years of software development... considering it's taught in schools these days. In a nutshell, a factory is a class who's purpose is to generate instances of other classes (https://en.wikipedia.org/wiki/Factory_method_pattern https://en.wikipedia.org/wiki/Factory_method_pattern).
The main reason they're used is to create objects without specifying the class of the object, however there are plenty of other reasons why they're common as well.
You start stretching it when you have FactoryFactory. This presumably would be a factory that creates factories. If I saw this in a code review, I would call it out, as it could most likely be refactored to be simpler. FactoryFactoryFactory is beyond silly.
- qw 9y agoI think you misread the comment. The poster says that the classes did not have the word «factory» in the name. The functionality was the same.