News for hackers. Stuff that matters.
Re:A FactoryFactoryFactory in Production by beager on Monday December 18, 2017 @12:25PM (#15953336)
Well, a factory pattern is a well-defined pattern in OO software design, and one that a developer of any experience level can look up and understand. Your particular implementation may give rise to a more plain and contextually-accurate name, but if you call it something other than a Factory, posterity may need more time and context to discern what your code does.

If I'm a new developer on a project, I know what a SprocketFactory does, and I know that I'm going to get SprocketFactorys from a SprocketFactoryFactory, and I know that if I call the SprocketFactoryFactoryFactory, I'm sure as hell gonna get back a SprocketFactoryFactory, which will then give me a SprocketFactory, which will then produce Sprockets.

Re:A FactoryFactoryFactory in Production by chimprich on Monday December 18, 2017 @01:19PM (#15953844)
If I'm a new developer on a project and see a class called "SprocketFactoryFactoryFactory" I'm probably going to cry for a bit and wonder whether I couldn't have got a better gig, and then try to figure out a better way of producing sprockets.

Human short-term memory only has a size limit of about 4 simultaneous chunks so once you're juggling those levels of indirection any development is going to be glacially slow until you've acquired a great deal of experience with the codebase.

Out of interest, can you describe a concrete case where multiple levels of factory patterns have actually been justified and resulted in simpler code than an alternative?

Re:A FactoryFactoryFactory in Production by nitrogen on Monday December 18, 2017 @05:17PM (#15956024)
If Java had default parameters and named parameters I think a ton of the need for Builders and Factories would go away.
Re:A FactoryFactoryFactory in Production by beager on Monday December 18, 2017 @05:53PM (#15956228)
I can't, but if you're the FNG on a project and see SprocketFactoryFactoryFactory, you may have a quick and easy path to a better solution. Just make sure that that better solution names its patterns well so the next FNG can make your code even better.
Re:A FactoryFactoryFactory in Production by lostcolony on Monday December 18, 2017 @01:18PM (#15953827)
I like how you assume that a mind that doesn't balk at "SprocketFactoryFactoryFactory" is also a mind that will ensure the implied contract of that name is adhered to. But I guess that sort of optimism -does- come with 'new developer on a project', so you're probably correct in what the developer will think they know.
Re:A FactoryFactoryFactory in Production by beager on Monday December 18, 2017 @05:59PM (#15956262)
I think between a horrible application of a pattern that has a good chance of being implemented properly and a horribly named class that leaves no potential to intuit its behavior, you might fare better with the former, as a new dev. But at that level it's all subjective.