The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
3answers
62 views

Client vs Creator in Factory Method and Abstract Factory patterns

This page descibes one important difference between Factory Method and Abstract Factory: http://architects.dzone.com/articles/factory-method-vs-abstract The difference, according to this page, is ...
1
vote
2answers
51 views

Why is entangling injectable with class that uses it a bad practice?

I have had this argument for a while, because I have noticed some people prefer "readable" code over properly structured one. So in the example I am showing, basically I have this Mapper class in ...
0
votes
1answer
83 views

How can one presenter be used for multiple views in MVP

I am using MVP for creating an android application, which takes data from server and sets to activity. I am forced to create one presenter for each view. Each view is unique because each view has ...
0
votes
3answers
138 views

Why static members can't be abstract and don't implement polymorphism? [duplicate]

I'm a Java/C#/PHP developer, through my OOP programming experience I find myself asking the same question: Why static members can't be abstract and don't implement polymorphism especially in ...
3
votes
2answers
449 views

What are the disadvantages of a “simple factory”?

I am reading the book »Head First Design Patterns« from O'Reilly. Before explaining the Factory Method Pattern, they introduce a Simple Factory first. They are using the example of a pizzeria. In a ...
4
votes
2answers
296 views

Does this factory method pattern example violate open-close?

In Head-First Design Patterns, they use a pizza shop example to demonstrate the factory method pattern. public abstract class PizzaStore { public Pizza orderPizza(String type) { Pizza pizza; ...
1
vote
2answers
464 views

When is it worth NOT using a Factory?

I'm employing TDD quite a bit these days and really enjoying myself - everything seems to flow better and be naturally better constructed and organized. However, while writing a bit of IO code, ...
0
votes
1answer
87 views

Using factory pattern when classes have little in common

I have used Factory pattern where I have multiple classes which does similar sort of work, but I don't want client to worry about class instantiating and return types. So Instantiate the necessary ...
1
vote
1answer
186 views

Differentiating between Factory Method and Abstract Factory

I've been confused for a while about the differences between the patterns Factory Method and Abstract Factory. Been doing a lot of research, still confused. I have one question: Is the only ...
1
vote
2answers
345 views

Factory Method vs. Factory Method design pattern

I am currently studying design patterns from the book (which, although I didn't try anything else, I find excellent) Head First Design Patterns. I'm confused about two concepts: The Factory Method, ...
0
votes
1answer
157 views

Why can't the Factory Method pattern create a family of objects? [duplicate]

There are two main differences between the design patterns Factory Method and Abstract Factory. Difference 1 is that Factory Method is mainly based on inheritance. A class in a way uses it's subclass ...
3
votes
3answers
246 views

Why should one subclass instead of composite when using the Factory Method design pattern?

I'm currently learning about design patterns. I learned about the Factory Method pattern. This pattern means that in order to implement a factory to create objects, one should subclass the class that ...
0
votes
0answers
67 views

Is Factory method subclass of Abstract factory in essence [duplicate]

Is it correct to say that factory method is essentially just a particular case of the abstract factory which produces the only one object not a group? I know that classic realizations assumes the ...
13
votes
3answers
5k views

Static factory vs factory as a singleton

In some of my code, I have a static factory similar to this: public class SomeFactory { // Static class private SomeFactory() {...} public static Foo createFoo() {...} public ...
1
vote
1answer
285 views

Is a Factory class still a Factory class if the objects it returns already exist?

I can't decide what to name my class. So far I've labelled it up as a Factory, but I am not sure. Here is the class. As you can see, it exists to return a concrete type of an Interface ...
1
vote
3answers
323 views

Better solution then simple factory method when concrete implementations have different attributes

abstract class Animal { function eat() {..} function sleep() {..} function isSmart() } class Dog extends Animal { public $blnCanBark; function isSmart() { return $this->blnCanBark; ...
2
votes
1answer
519 views

Is there a factory pattern to prevent multiple instances for same object (instance that is Equal) good design?

I have a number of objects storing state. There are essentially two types of fields. The ones that uniquely define what the object is (what node, what edge etc), and the others that store state ...
12
votes
2answers
819 views

I should have used a factory method instead of a constructor. Can I change that and still be backwards-compatible?

The problem Let's say I have a class called DataSource which provides a ReadData method (and maybe others, but let's keep things simple) to read data from an .mdb file: var source = new ...