Skip to main content
2 votes
1 answer
64 views

How to type hint a python factory method returning different types?

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
3 votes
0 answers
64 views

Container validation when using the factory methods in .NET Core DI

Let's say that we have the following 2 services: class OtherService : IOtherService { } public class ParameterizedService { public ParameterizedService(IOtherService otherService) => ...
Serg's user avatar
  • 4,831
0 votes
0 answers
53 views

Possible to intercept class instantiation in PHP?

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

Should/could I use Java abstract factory (or factory method) in this situation?

In a coding exercise I want to create a Java software for an hypothetical shop: I have a User superclass and three subclasses: administrator (who can manage the product catalog and the customer's list)...
Alex's user avatar
  • 13
0 votes
1 answer
56 views

Is there a simple way of accessing a function from another Activity in Android Studio

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
-1 votes
1 answer
119 views

How to get factory method to return a derived class? [duplicate]

I am trying to make a factory method, but it is currently throwing an error: core\loaders\loader.cpp:11:12: error: cannot convert 'Jpeg' to 'Loader*' in assignment 15 | loader = Jpeg(path); ...
Get Off My Lawn's user avatar
0 votes
4 answers
233 views

Why to use factory pattern

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
0 votes
0 answers
56 views

Factory method with generics c# [duplicate]

I am trying to implement a factory method pattern with generics in c#. this is my code: // IDomGen is just an empty interface that I just use as a "marker" public abstract class AbsPersMySQL&...
The Piccion's user avatar
2 votes
0 answers
58 views

How can we reduce a multi-functional class with conditional logic into fundamental classes with specific logic - C# ASP.NET Core

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 votes
1 answer
94 views

Do I need to overload the constructor | factory method for each combination of constructor's | factory method's arguments?

I have 4 instance variables that can be initialized by default, is the code written below appropriate? The number of constructors is growing a terrible pace, will I use the Builder object that have ...
Gor Madatyan's user avatar
1 vote
1 answer
139 views

Why is class and subclass reduction a particular consequence of the Prototype design pattern?

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
2 answers
196 views

How to have Factory registry macros in the beginning of header files?

Currently, the Factory registry macro im using is at the bottom of the header file: #pragma once #include "GameObject.h" class Foo : public GameObject { //... }; ENGINE_SPAWNABLE(Foo); ...
user avatar
0 votes
1 answer
139 views

Identify the best architecture for sending different types email in ASP.NET Core

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
0 votes
2 answers
393 views

Generator with factory method

I have a problem with the proper arrangement of services.I want to create a generator that, thanks to the provider, will create the corresponding generator object through the factory method.In my mind ...
KPHP's user avatar
  • 1
1 vote
1 answer
98 views

Override the __init__ method of a base class to edit a string literal

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

15 30 50 per page
1
2 3 4 5
18