Top "Factory" questions

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

How to inject Spring Bean for factory method requiring MyClass.class parameter

I'm trying to inject a java.util.prefs.Preferences bean in to my master controller. The controller looks like: @Controller …

java spring class preferences factory
Factory pattern in C#: How to ensure an object instance can only be created by a factory class?

Recently I've been thinking about securing some of my code. I'm curious how one could make sure an object can …

c# design-patterns oop factory
How to name factory like methods?

I guess that most factory-like methods start with create. But why are they called "create"? Why not "make", "produce", "build", "…

coding-style naming-conventions methods factory
Factory classes

Personally I've never understood the idea of factory classes because it seems a whole lot more useful to just instantiate …

java oop object factory
AngularJS factory http returns empty

I'm trying AngularJS for the first time. I'm getting JSON data from a http-get request using a factory, but the …

http angularjs factory angularjs-service
How to pass arguments to Laravel factories?

I have a users table and a one-to-zero/one relation with a businesses table (users.user_id => businesses.user_…

laravel factory laravel-seeding
"Singleton" factories, ok or bad?

I've a lot of (abstract) factories and they're usually implemented as singletons. Usually for the convenience of not having to …

singleton factory
Using Enum for factory in Java, a best practice?

Java allow us to embed data and behaviour on Enum. I don't want to implement a factory directly on an …

java enums factory
Factory in Java when concrete objects take different constructor parameters

I'm trying to implement a Factory pattern in Java. I have a class called Shape which Circle and Triangle extends. …

java design-patterns factory
What exactly is a Class Factory?

I see the word thrown around often, and I may have used it myself in code and libraries over time, …

class factory