Skip to main content
3 votes
2 answers
106 views

How to write an abstraction in Rust with multiple implementations

In my application I want to have an EventPersister trait that defines an abstraction of persisting events, then have various implementations that, for example, persist events in memory, in the file ...
bikeman868's user avatar
  • 2,589
0 votes
0 answers
19 views

Building a "Catalogue" mapping configurations to classes in python

I have many classes in Python, all inherited from the same abstract class. Each class has a config of its own. I want to create a catalog/builder class where I map the configs to the classes once. The ...
nono's user avatar
  • 185
0 votes
0 answers
40 views

Using Factory Pattern yields No qualifying bean for service interface injected into springboot controller

I am facing an issue with my spring-boot application. The API is using the factory design pattern along with JpaRepository. The API manages creation of "Route" which is "Road" in ...
Himmels DJ's user avatar
0 votes
0 answers
99 views

How to ensure initialization of static variables without explicitly including the header file

Considering the following example: A class named ObjectFactory is defined to manage the creation of several classes. These managed classes should be registered with the factory so that we can create ...
Woody Huang's user avatar
2 votes
1 answer
178 views

The way to filter objects by type in the factory

I have the factory that contains a map with the names of objects as key and pointer to function as value template<class T> static T* makeObj() { return new T(); } using createFunction = std:...
Andrii's user avatar
  • 23
0 votes
2 answers
334 views

Understanding Factory Design Pattern in Python

The Python version of the Factory pattern in Refactoring Guru is: from __future__ import annotations from abc import ABC, abstractmethod class Creator(ABC): @abstractmethod def factory_method(...
Jay's user avatar
  • 134
0 votes
2 answers
95 views

How to Use Factory Pattern With Dependency Injection and input parameters?

I'm trying to understand how to create an instance of a service (for example, ITransport) with some input config at runtime using the Factory Pattern and Dependency Injection (Microsoft.Extensions....
Taras's user avatar
  • 49
2 votes
1 answer
81 views

C++ factory of a container type without defining the container element type

Based on this topic, I wonder if it would be possible to have a factory class that would provide a container type, without defining the type of element of the container. Something like: template <...
canellas's user avatar
  • 687
0 votes
0 answers
40 views

Factory Reverse design pattern discussion

I used to use factory method as a creational design pattern, but now I got stucked in the situation which is reversing the problem. The normal behavior to create the factory pattern. I am facing the ...
abdekrazek mostafa's user avatar
0 votes
0 answers
109 views

How to merge two view content using factory design pattern in swift

I am following factory design pattern . From the view model state response I am rendering the view. For movie details view I am rendering MovieDetailsDisplayViewController. view content. Here is view ...
user avatar
0 votes
1 answer
97 views

Why do we use factory class to instantiate interface

I'm currently reading book pro spring 6. I am a bit confused on one example from book Here is the main class: public class HelloWorldDecoupledWithFactory { public static void main(String... args)...
houhou's user avatar
  • 23
0 votes
2 answers
211 views

Does factory design pattern violate Dependency Inversion Principle of solid principle in C#? [duplicate]

By definition, dependency injection promotes loosely coupled, maintainable, and testable code, and using interface and constructor injection we can get the object of the class implementing the ...
Sandhya Ratan's user avatar
0 votes
1 answer
46 views

Factory Method: Why not one CreateMethod in Factory for each Type?

So I was reading along Design Patterns book to look up some details on the Factory Pattern. I was reading about two main variants of implementation: Using the abstract Factory and ConcreteFactories ...
John Doe's user avatar
1 vote
2 answers
2k views

How to resolve services in factory class using dependency injection? | C#

I have six implementations for the same interface registered on my DI container, like so: services.AddScoped<IProductService, ProductService1>(); services.AddScoped<IProductService, ...
Anna Aimeri's user avatar
0 votes
1 answer
77 views

Mod-wsgi calls flask factory function twice

I am trying to build a flask app and using mod_wsgi server for hosting. I use a factory function to create the flask app but I observe that mod-wsgi calls the factory function twice within the same ...
Kevin123's user avatar

15 30 50 per page
1
2 3 4 5
99