Linked Questions
26 questions linked to/from Factory Pattern. When to use factory methods?
3 votes
3 answers
3k views
Avoid Using InstanceOf with Visitor Pattern - Java
I searched about this subjet arround here in Stack Overflow. I found the following solution: Explanation of Visitor Pattern Now, my case is simillar to this one. I need, however, to avoid the use of ...
2 votes
4 answers
1k views
Typescript Type Declaration for Abstract Class Implementations
I'm trying to figure out how to provide a type definition that corresponds to "all classes that implement some abstract class." Take the following code example: abstract class AbstractFoo { ...
0 votes
2 answers
1k views
How do I select a class dynamically?
I have two classes that extends a third class, i.e. public class class_a extends parent_class and public class class_b extends parent_class My question is it possible to have a third class to ...
1 vote
1 answer
1k views
how to about mvc in relation with factory pattern
Sorry if is a dummy question but I'm not really clear with it. Is it a good practice to integrate factory pattern in an mvc using php. For example could I have the following library structure: index....
2 votes
1 answer
1k views
How does using the factory design pattern stop a class having to anticipate the class of objects it must create
As I understand it the factory design pattern allows objects to be created through the use of a separate object that's sole aim is to create the first one. Different types of factory can be used to ...
1 vote
1 answer
873 views
Applicability for the Factory Method Pattern
I am confused at the factory-method pattern. The below code is from "https://www.oodesign.com/factory-method-pattern.html" public interface Product { � } public abstract class Creator { ...
1 vote
2 answers
260 views
C# How to make sure that implementation of an interface has a field with value that can be read via reflection, without creating an instance?
... Or a different way of implementing this: I have an interface called ICommunicationProvider which is then extended by ISMSCommunicationProvider, IEmailCommunicationProvider, ...
1 vote
2 answers
528 views
Factory method - Does application class need to be abstract?
Erich Gamma's GOF design pattern book says: Whereas the word application can create several documents on its own as shown below: It appears that one application can create several documents. In what ...
0 votes
2 answers
143 views
Idiomatic way to have constructor methods required by interfaces
I'm trying to initialize generic types in generic methods. I've since learned you can't require constructors in interfaces, so I figured out how to use generics to roughly fake the same behavior: ...
0 votes
1 answer
169 views
design pattern definition
I'm trying to make a simple game. I have a class for the screen buffer, a class for the images, and a class for the sprites. My question is this: Since every sprite needs to "belong" to some image (...
1 vote
3 answers
139 views
what if we don't use the factory design pattern?
I'm a newbie to design pattern. And I'm trying to learn some design patterns. I read blogs online and most of them directly show me that: this is the simple factory and this is how we use it. I ...