11 questions from the last 30 days
Best practices
0
votes
3
replies
65
views
Can a Composite Component class inherit from another abstract base class without breaking the Composite pattern?
I’m studying and implementing the Composite design pattern in C# for a university project.
In most textbook examples (GoF, Refactoring.Guru, etc.) the class hierarchy looks like this:
Component
├── ...
Best practices
2
votes
4
replies
107
views
When is it OK to use a singleton?
Follow-up on this question: Singletons: good design or a crutch?
It is true, that using singletons can make testing harder, and bugs can hide behind them. GoF defines singleton to use when:
Global ...
1
vote
1
answer
78
views
What is the most Pythonic way to create a subclass of an object based on a string parameter
What is the best practice for creating an object based on the value of a string argument?
I am loading my configuration from a file and passing the string as an argument that gets mapped to a specific ...
0
votes
0
answers
80
views
How to register function delegate with interface that has a generic type?
I wanted to create a flexible MessageProcessor, depending on the SupplierType(= enum) and depending on which MessageProcessor comes out a different Message-object will be used.
The current situation ...
1
vote
0
answers
67
views
How to provide type-safe factory functions for dynamically registered classes in Python?
TL;DR
Suppose a Python library defines an interface meant to be implemented by third-party code. How could this library provide a factory function that creates instances of those implementations, with ...
Advice
0
votes
0
replies
25
views
Designing a props-driven test framework for data quality validation - best patterns?
Question: I'm building a testing system for a data quality SaaS app where tests are entirely props-driven (similar to React component testing philosophy).
Goal: Create reusable, composable test ...