Skip to main content

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
21 votes
2 answers
5k views

Python - Tkinter - periodic table of chemical elements

Inspired by a question on StackOverflow I decided to code a GUI that is simple, efficent and can be used in other projects as well. I wanted to share this code since it probably is usefull to other ...
Thingamabobs's user avatar
13 votes
2 answers
159 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 ...
301_Moved_Permanently's user avatar
14 votes
4 answers
2k views

Numerical integration in C++: Newton-Cotes formulas

I have tried my hand with implementing simple quadrature formulas in C++. Definite integral: $$\int_a^b f(x) dx$$ Domain of integration \$[a, b]\$ divided into \$n\$ intervals of equal length \$h = (b ...
Giogre's user avatar
  • 331
10 votes
0 answers
1k views

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
10 votes
3 answers
677 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 ...
Moon's user avatar
  • 378
8 votes
1 answer
526 views

Private VBA Class Initializer called from Factory

I've been playing with COM lately and while getting to understand the mechanism of how class methods/properties are called an idea came to mind: what if we can have a global instance of a class that ...
Cristian Buse's user avatar
7 votes
1 answer
4k 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 ...
Cilyan's user avatar
  • 285
6 votes
2 answers
516 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 ...
ExohJosh's user avatar
  • 163
4 votes
0 answers
621 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 ...
Cilyan's user avatar
  • 285
4 votes
2 answers
69 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 ...
ovidiu-miu's user avatar
3 votes
1 answer
2k views

Implement Factory pattern with multiple parameters and each parameters are interface

I am a little bit confused on Factory Method with multiple parameters in which all parameters can change from GUI by user as seen below picture. For each combobox item I have an interface and ...
YrnHkn's user avatar
  • 33
3 votes
2 answers
118 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 ...
t3chb0t's user avatar
  • 44.3k
3 votes
2 answers
250 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 (...
B. Clay Shannon-B. Crow Raven's user avatar
2 votes
1 answer
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 ...
ICJ's user avatar
  • 171
2 votes
1 answer
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 ...
MplsAmigo's user avatar
  • 121
1 vote
2 answers
455 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 ...
Sandoval0992's user avatar
1 vote
1 answer
387 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 ...
ICJ's user avatar
  • 109
1 vote
1 answer
67 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 ...
Snowbody's user avatar
  • 8,442
0 votes
1 answer
190 views

Web scraper for e-commerce sites

I'm building web scraper application which takes name, code and price from few sites. I thought factory pattern would fit in my application. I would like to someone review my code and tell if I ...
Xyloto's user avatar
  • 123