Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
67 views

I am working on a generic framework with the goal to solve different but related problems. A problem consists of data and a bunch of algorithms operating on this data. Data and algorithms may vary ...
Durtal's user avatar
  • 1,108
0 votes
0 answers
53 views

Is there a way in PHP that, every time I instantiate a new class — e.g. $o = new SomeClass() — I can "intercept" that and actually return some other class? Or, more specifically, I want to ...
Colin's user avatar
  • 2,249
0 votes
1 answer
59 views

This is a quick question that I hope someone can help me out with. im fairly new to AS and I hope I am not over thinking this, but I'm a big beleiver in studying a topic fully, and have just spent the ...
John B Gilbert's user avatar
0 votes
4 answers
237 views

I am trying to understand the Factory Method design pattern and i have come across multiple questions similar to the one on my mind but my question still remains unanswered. this is the article I am ...
Haricharan Reddy's user avatar
2 votes
0 answers
60 views

In an ASP.NET Core EF application, I have a CentralDesignObject with many types of related data, and a significant amount of derived / calculated values based on the information applied to the ...
freedomdev's user avatar
1 vote
1 answer
144 views

I read the Design Patterns book (written by the Gang of Four) and I'm now recapping on the Prototype Design pattern. In the consequence section, of the Prototype design pattern, (explained on page 119 ...
Niek Beijloos's user avatar
0 votes
1 answer
139 views

I have defined an interface IEmailManager as having send method. The email controller is using its concrete type EmailManager as a constructor dependency that sends the email. public interface ...
Engr Umair's user avatar
1 vote
1 answer
99 views

So let's consider the following classes. I have no control over classes A, B, and C and can't change the implementation. class A(object): def __new__(cls, root=None): if root == "Some ...
Rick's user avatar
  • 13
4 votes
4 answers
551 views

Source of Question I was wondering about the following advantage of Static Factory Methods described by Joshua Blochs "Effective Java", 3rd edition in item #1: A second advantage of static ...
citizen_code's user avatar
-1 votes
1 answer
209 views

have this enum file containing some information: public enum Constants { AGED_BRIE("Aged Brie"); private final String label; Constants(String label) { this.label = ...
Anna's user avatar
  • 127
2 votes
2 answers
3k views

Using Jackson, I want to deserialize some values into generic wrapper objects for which I have a specific static factory method for each type. However, Jackson does not seem to pick up on this layer ...
neXus's user avatar
  • 2,303
0 votes
1 answer
281 views

I would like to ask you to help me out with my factory method. I have to handle multiple and periodic csv objects, each of which has its own properties, thus its own class. The only way I can tell ...
Marco's user avatar
  • 47
1 vote
0 answers
76 views

In the following simple code I return a function local object from a function (factory function). Does the C++ standard guarantee in every case that this object is being returned as an rvalue ...
glades's user avatar
  • 5,356
1 vote
0 answers
441 views

Context I'm using ABC to create a bunch of sub-classes like so: from abc import abstractmethod, ABC class Person(ABC): @property @abstractmethod def person_name(self) -> str: ...
ResponsiblyUnranked's user avatar
1 vote
1 answer
129 views

Consider a factory method pattern implementation: import UIKit protocol TransportProtocol: CustomStringConvertible { func techReview() } // Make default implemetation opposed to @objc optional ...
Paul B's user avatar
  • 5,333
2 votes
2 answers
3k views

The abstract factory pattern is useful when we have families of related classes, and we want to instantiate them without relying on the implementation. However, what's wrong with using the factory ...
abumandour's user avatar
  • 1,379
5 votes
3 answers
2k views

I'm just learning Rust, so maybe I just didn't get some concepts correctly. I have a trait with some implementations: trait Abstract { fn name(&self) -> &str; } struct Foo {} struct ...
Kirill's user avatar
  • 8,421
0 votes
1 answer
190 views

Let's say I have a factory like this: const itemFactory = () => { const itemName = '' const firstMethod = () => { // something goes here } return { itemName, firstMethod ...
Eaguilar's user avatar
0 votes
1 answer
222 views

There are two classes Base and Derived. Base.h: class Base { public: Base* create_obj(); }; And Base.cpp : #include "Base.h" Base* Base::create_obj() { return new Derived(); }; and ...
Learner's user avatar
  • 101
1 vote
1 answer
249 views

I have the following python code, where I create a food object, which adds instance attributes according to the food type: class Food: def __init__(self, type): self.type=type ...
user3563894's user avatar
5 votes
4 answers
2k views

Im trying to learn patterns and got to Factory, I understand the concept of simple factory and factory method, I know how they work, what I cant understand is what is the benefit of factory method ...
user924941's user avatar
  • 1,021
1 vote
2 answers
616 views

I'm learning Java design patterns by "Patterns in Java", volume 1 by Mark Grand (Factory Method specifically). My point is to highlight difference between closest patterns for myself. There ...
peremeykin's user avatar
2 votes
1 answer
2k views

Refactoring Guru provides a good example for factory method. In that example there are Common product interface, Concrete products, Base creator and Concrete creator. But in Calendar, I find only ...
user344563's user avatar
1 vote
1 answer
867 views

I am confused at the factory-method pattern. The below code is from "https://www.oodesign.com/factory-method-pattern.html" public interface Product { � } public abstract class Creator { ...
선상원's user avatar
0 votes
2 answers
590 views

I would like to create some kind of factory function, but instead of returning a pointer to a certain class object, I would like to pass a pointer to the base class to a function as an argument. What ...
vargss's user avatar
  • 39

1
2 3 4 5 6