The factory tag has no wiki summary.
-1
votes
0answers
28 views
Basic PHP Factory Pattern code review
I have an object, KbArticle, that originally in it's constructor, would try to return null if the SQL query that retrieves the data for its required properties came up with 0 rows. A friend told me ...
0
votes
2answers
105 views
What are the benefits of using a 'decorator factory' that decorates objects?
In a project I decided to implement the Decorator pattern.
I have a class Thing with methodA(), and a class AbstractDecorator that inherits from Thing and that all decorators inherit from: ...
0
votes
7answers
344 views
Using a Simple/Static Factory vs. instantiating directly: new Thing() vs. factory.createThing() - what's the benefit?
Here are two ways to instantiate an object:
Option 1:
Thing thing = new Thing();
Option 2: (the factory is a Static Factory, but it could also be a Simple Factory).
Thing thing = ...