As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [factory-method]

Use this tag for code reviews of, or involving methods that create a new instance of a given type, often with parameters that determine how the instance gets created.

14 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
10 votes
0 answers

Private VBA Class Initializer called from Factory #2

About This is a follow-up of a previous question Private VBA Class Initializer called from Factory. I've decided to create a new question instead of answering my old question because I would like the ...
Cristian Buse's user avatar
5 votes
0 answers

Factory class that uses reflection to instantiate objects by class name

In this SO post Dynamically choose class from string Alexander Platonov creates a Function on the fly and then uses Application.Run() to instantiate an Object by ...
TinMan's user avatar
  • 4,068
4 votes
0 answers

Chained Factories by Expression Template

I want to make factories that can chained together to create a pile of layers. One of the advantage of chained factories is that later factories can pass specifications to earlier factories. For ...
R zu's user avatar
  • 297
4 votes
0 answers

Extensible factory method for starting D3 charts

I'm working on refactoring some existing code to be a bit more extensible and am wanting to create a generic factory API for starting D3 charts. Currently, my factory looks like this: ...
aendra's user avatar
  • 141
4 votes
0 answers

Compile-time plugin system (2)

Background This is a follow-up of this CR: Compile-time plugin system. The code exposed below can also be browsed on this gist, which shows the differences between both questions (original is version ...
Cilyan's user avatar
  • 285
3 votes
0 answers

Angular OOP services and caching

I've created a caching service using OOP techniques combined with the revealing module pattern and the angular-cache library. New CacheDataClass objects are ...
br3w5's user avatar
  • 255
3 votes
0 answers

Threadsafe singleton factory to use in Apache thrift server RPC system

My goal was to write a factory that the code did not have to be edited. Thus I am registering my factory functions into a singleton factory. I am going to be using this code in Apache thrift server ...
user249806's user avatar
2 votes
0 answers

Swift Struct-based Factory Pattern

Edit: I added another configuration vector to CardView, a size attribute, which may be .small or ...
Richard Robinson's user avatar
2 votes
0 answers

Show mobile SoundCloud player in WebView

Demo for a SoundCloud player in WebView for specific song or artist stream as a workaround because SoundCloud is not accepting API key request anymore. SoundCloudWebView: ...
Vhalad's user avatar
  • 91
2 votes
0 answers

Simple files parsing and info extraction

First let me describe the problem, we want to solve: We have hierarchical directories structure with different types of templates. Each type of templates is located in dedicated folder. Hierarchical ...
Jevgenij Nekrasov's user avatar
2 votes
0 answers

Factory (pattern) of Commands (pattern) with additional dependency injection (dependency inversion pattern)

What would you improve at the following code, except: The problems I'm already aware of, marked as TODO Line width of at most 120 characters (I've run flake8 over ...
Flavius's user avatar
  • 129
1 vote
1 answer

Factory pattern with variadic constructor

I have this code for a factory design pattern that will take into account any number of arguments in the constructor. Through a static boolean in the class a ...
Thomas Jerry's user avatar
1 vote
0 answers

Logs UI errors to a service provided in the configuration

As part of the project I am currently working on we want to log our UI component errors as well. I developed this package as a base. It's a factory (basically, not sure if it's correctly a factory). ...
Andreas Andreou's user avatar
1 vote
0 answers

Creating objects by defined name

I'm trying to write universal factory creating objects by name. I've got some working prototype now but there must be a better way than casting construction methods to void pointer. ...
Travis's user avatar
  • 13