factory-pattern Questions
3
Solved
After listening to the Clean Code Talks, I came to understand that we should use factories to compose objects. So, for example, if a House has a Door and a Door has a DoorKnob, in HouseFactory we c...
Bergschrund asked 24/1, 2012 at 0:9
1
Solved
Okay, so I have been given an assignment where I am asked to use both the Strategy and Factory design patterns. Here is the problem:
You are developing an application for a bank to use for handlin...
Genera asked 17/11, 2012 at 1:30
4
I'm reviewing code with a lot of statements like this:
private SomeInterface x = Locator.getInstance(SomeInterface.class)
I would expect something like
private SomeInterface x;
@Inject
public ...
Glyn asked 9/6, 2011 at 10:23
1
Solved
I have been trying to learn about dependency injection and have been reading about and trying to code a small dependency injection container similar to this: http://fabien.potencier.org/article/12/...
Exclaim asked 24/8, 2012 at 7:44
1
Solved
How would I be able to rewrite the the following utility class to get all the class string values for a specific type - using the Objective-c runtime functions as shown below?
The ARC documentatio...
Leanneleanor asked 11/7, 2012 at 14:15
3
Solved
Want to check if this a good example for representing the abstract factory pattern.
Here is the theme
Dell (Factory) makes xps (Product)
Dell (Factory) makes inspiron (Product)
hp (Factory) makes e...
Disengagement asked 24/2, 2011 at 18:50
4
Solved
Here is the way I typically see the Abstract Factory Pattern shown:
public abstract class Factory
{
public abstract Product GetProduct();
}
public class ConcreteFactory1 : Factory
{
public...
Hundred asked 21/6, 2012 at 21:58
3
A continuation from Dependency injection, delayed injection praxis. I have the Main class:
package test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework....
Quintain asked 3/5, 2012 at 10:31
2
Solved
I have to parse some numbers from file names that have no common logic. I want to use the python way of "try and thou shall be forgiven", or try-except structure. Now I have to add more than two ca...
Recipient asked 25/4, 2012 at 14:27
2
Solved
Like many before me, I'm trying so get my derived types to automatically register with my factory. I read through many question and tried to focus on what I didn't find there.
I've got everything ...
Bisect asked 2/4, 2012 at 11:35
4
Solved
I have been reading Effective Java by Joshua Bloch and so far it really lives up to its reputation. The very first item makes a convincing case for static factory methods over constructors. So much...
Credulous asked 9/3, 2012 at 15:3
3
Solved
I have an abstract class called Validator:
public abstract class Validator<T> where T : IValidatable
{
public abstract bool Validate(T input);
}
And I have a few concrete implementations....
Jamnis asked 9/3, 2012 at 10:31
3
Solved
I use Factories (see http://www.php.net/manual/en/language.oop5.patterns.php for the pattern) a lot to increase the testability of our code. A simple factory could look like this:
class Factory
{
...
Bailiwick asked 18/7, 2011 at 9:38
1
Solved
As I understand Factory Method is Simple Factory and Factory Object is Abstract Factory?
And:
-Factory Method (Simple Factory):
public class SimplePizzaFactory {
public static final int CH...
Yoko asked 2/2, 2012 at 18:50
2
Solved
I know similar questions were asked before. I've been reading a lot about this during the last couple of days and I think I can now understand the differences in terms of design and code flow. What...
Platto asked 21/1, 2012 at 12:5
3
Solved
I have a list of jobs queued in the database which I need to read from database and execute them in parallel using threading and I have a list of command classes to execute each of those jobs all i...
Baldheaded asked 9/1, 2012 at 12:21
6
Solved
I've been reading up on the Factory pattern, and have come across articles that suggest using the Factory pattern in conjunction with dependency injection to maximize reusability and testability. A...
Minier asked 20/12, 2011 at 15:50
1
Solved
I am trying to serialize/deserialize objects that have factory-created members. For example, lets say there are a member of type Foo, which is instantiated using FooFactory.CreateFoo(int bar).
My ...
Zenobiazeolite asked 21/11, 2011 at 12:27
3
Solved
I have a GUI application. In it I allow a user to select from a container-provided list of algorithms. Each algorithm will be kicked off as a background task in another view. I need to support mult...
Trichloromethane asked 17/11, 2011 at 11:56
3
Solved
This is about the Factory Pattern. I am a little confused.
I saw implementations where the createInstance() method is static and some implementations that are non-static.
Some say it's depending ...
Drury asked 26/10, 2011 at 20:13
3
Solved
I have the following concrete Animal products: Dog and Cat.
I am using a parameterized Factory method to create said products. Depending on the AnimalInfo parameter that is passed to the Factory m...
Garb asked 24/10, 2011 at 13:36
7
Solved
When implementing a MessageFactory class to instatiate Message objects I used something like:
class MessageFactory
{
public:
static Message *create(int type)
{
switch(type) {
case PING_MSG:
...
Involuntary asked 17/5, 2010 at 15:9
1
Solved
PHP OOP design - limiting parameters to specific child classes while implementing generic interfaces
I often do PHP projects designed to scrape hierarchical data from web pages and save them to the DB (essentially, structure the data - think scraping government websites that do have the data, but ...
Toadstool asked 6/10, 2011 at 21:40
2
I'm looking for an abstract factory for class templates, where the classes register themselves automatically at static initialization time. For regular (non-templated) classes, the solution is stra...
Astragal asked 6/10, 2011 at 19:15
4
Solved
In most of the factory pattern implementations, the getInstance method is usually declared as static. The main advantage of factory pattern is to hide the implementation details, but why does getIn...
Melisenda asked 12/9, 2011 at 20:36
© 2022 - 2024 — McMap. All rights reserved.