Skip to main content

Questions tagged [factory-method]

4 votes
3 answers
3k views

Description I want to create an instance of an object at runtime, however, the parameters used to create the object are not always the same. To help explain, I have created a simplified example (in ...
zwoolli's user avatar
  • 151
0 votes
0 answers
1k views

I have the following classes in my system (python): class Metric(ABC): def compute(self): -> float class Visualization(ABC) def visualize(self) class FirstMetric(Metric) def __init__(...
ledermauss's user avatar
0 votes
3 answers
769 views

Suppose we have a BaseModel, which has a type enum, and derived models with same constructor signatures to each other, whose implementations are like : public DerivedModelJ(Object arg1, ..., Object ...
Mike Warren's user avatar
-2 votes
1 answer
684 views

I have a program which downloads web pages and then scrapes html to create domain specific collection objects e.g. ProductCollection, CatalogCollection, NewsCollection and more. The idea is to create ...
Navjot Singh's user avatar
0 votes
2 answers
600 views

I need to vary the object creation at (*). public class Parser { // Problem code public List<FileOption> methodA() { // Does something ... fileOptions....
Sebastian Nielsen's user avatar
3 votes
1 answer
2k views

I always had problems in grasping the full benefits/motif behind using the Factory design pattern (for this post, I will stick to Factory Method pattern, specifically). True, there are (really) lots ...
Veverke's user avatar
  • 541
21 votes
6 answers
13k views

I am new to design patterns and working my way through the Factory Method and Strategy patterns. I understand that Factory is a creational pattern and Strategy is behavioral but I struggle to ...
Reynier Booysen's user avatar
5 votes
5 answers
4k views

So almost every post I read about oop by purists, they keep stressing about how using static methods is anti pattern and breaks the testability of the code. On the other hand every time I look for ...
lahory's user avatar
  • 315

15 30 50 per page
1
2 3 4 5