The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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.

Filter by
Sorted by
Tagged with
11
votes
2answers
128 views

“Drone Racer” now shipping in your local area

This question is a follow-up of this one; where I present a software to plan and manage drone races. I might come with a new question about the SQL part in a few days as well. The code can still be ...
10
votes
3answers
642 views

Is this correct factory method pattern?

I know that there are many similar questions, but I don't understand most of those questions because I'm not sure if I know what a factory method pattern is. So, after reading many examples over the ...
7
votes
1answer
2k views

Compile-time plugin system

Background For a piece of software that I need to get extensible, I wanted to design a simple compile-time "plugin" system in C++. My use case was that the program (actually a library) can accept ...
3
votes
2answers
248 views

RFC on “Factory” code [closed]

This is the first code of this type that I've attempted, so I'm wondering if anybody would be willing to critique it. It's "sort of" (I think) a factory class. I want to keep it as simple as possible (...
6
votes
2answers
352 views

Simple factory pattern for cooking a pizza

I have developed a command line application which prompts the user to initially select an oven and then requests that they cook a pizza. The oven affects the pizzas cooking time. The pizzas ...
4
votes
2answers
59 views

Configuring an editor for various languages using Factory Method Pattern

I need to know if my code is a valid implementation of the factory method pattern. Also, if the Configuration and Editor were interfaces would this still be a valid implementation of the Factory ...
3
votes
2answers
109 views

Sequence generators not only for potatoes but also for apples and oranges

The last question about sequence generators Growing potatoes in delayed sequences was only about potatoes. I thougt why not make it work with apples and oranges too so I made it generic. The base ...
2
votes
1answer
2k views

Replacing IUnitOfWork with a Factory Pattern

As a follow-up to this blog post and this question, I wanted to post my idea of replacing the IUnitOfWork with a factory pattern. It seems to me that in the case of this blog post the IUnitOfWork ...
2
votes
1answer
1k views

Implementation of MVC Bootstrap & Factory

Before I get started, I feel I need to list the following. I am not looking for an existing DI or Framework this is a personal project to shift from procedural to oop programming. Tear this apart. I ...
2
votes
0answers
316 views

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 ...
1
vote
1answer
63 views

Interfaces & Factory for generic container supporting PeekMax, PeekMin, Sum, and PeekNextToMax

This is a partial update of this question. An implementation of these interfaces is in this question. To summarize, the class is a generic container similar to MaxHeap, but only needs to support the ...
1
vote
2answers
308 views

Factory design pattern with Shapes

I'm making the very common example of Factory design pattern which creates a factory of shapes and return an instance of the type Shape. I wonder which is the best way to replace that bunch of nested ...
1
vote
1answer
310 views

Factory dependency injector

I recently made the switch from procedural to OOP style of coding. I decided I wanted to learn how everything works before deciding to jump into a framework, follow tutorials, and becoming dependent ...