Top "Factory" questions

"Factory" is a general term for object-oriented programming patterns which create objects.

Factory Pattern - CreateInstance static or not?

This is about the Factory Pattern. I am a little confused. I saw implementations where the createInstance() method is static …

design-patterns factory factory-pattern factory-method static-factory
Java Generics and Static Factory Methods -- Syntax

Here's what I've got: public class Node<T> { // instance variables private Node<T> next; private T …

java generics syntax static factory
angularjs defining services for the same module in different files

I have two files in which I define services in my angular app, but when I try to use them …

javascript angularjs service dependency-injection factory
Factory pattern in Python

I'm currently implementing the Factory design pattern in Python and I have a few questions. Is there any way to …

python design-patterns factory factory-pattern
Factory Pattern without a Switch or If/Then

I'm looking for a simple example of how to implement a factory class, but without the use of a Switch …

c# factory factory-pattern
Polymorphic factory / getInstance() in Java

I'm aiming to create a set of objects, each of which has a unique identifier. If an object already exists …

java design-patterns polymorphism factory
What's the preferred way to implement a hook or callback in Python?

I'd like to provide the capability for users of one of my modules to extend its capabilities by providing an …

python callback hook factory
How do I use $location to to get the protocol host and port of my current url in a factory

How do I get the current protocol host and port of my current url? app.factory('actionTypeFactory', ['$resource', function($…

angularjs location factory
Using Reflection in factory pattern

Is it a good practice to use Reflection in Factory pattern? public class MyObjectFactory{ private Party party; public Party getObject(…

java reflection factory factory-pattern
How to implement factory pattern with generics in Java?

I have a generic interface Handler public interface Handler<T> { void handle(T obj); } I can have n …

java generics factory