32,163 questions
Best practices
1 vote
2 replies
45 views
Finite State Machine for different enemies
I’d like to ask about best practices for using a finite state machine to handle different enemy behaviors. I already created a state machine for my basic enemies with the following behavior: ...
Best practices
0 votes
1 replies
55 views
How to pass around scipy fit results and corresponding functions
I am looking for advice on how to best pass around the fit results from a (Python) script to another script. Currently, I am exporting the best-fit parameters and function names into a YAML file. I ...
Best practices
3 votes
3 replies
68 views
How to avoid messy if statements when using many feature flags in Angular?
I’m part of a team of 10 developers, and recently our product team requires us to use feature flags for almost every new change. The idea is that they can always “roll back” to the previous behavior ...
Best practices
0 votes
0 replies
47 views
Testing in MVVM architecture. What to test and how to approach TDD?
I’m currently working on a personal Android project using Kotlin and Android Studio, following a basic MVVM architecture: ─main │ ├───java │ │ └───com │ │ └───example │ │ └───...
Best practices
0 votes
3 replies
77 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 ├── ...
1 vote
1 answer
86 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 ...
Advice
0 votes
0 replies
30 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 ...
Best practices
1 vote
2 replies
58 views
What is the best pattern for SwiftUI Document Application?
I am trying to create a full SwiftUI Document app (using swift 6, as it matters). Apple doc says that the Document init(configuration:)and fileWrapper(configuration:)are called on a background thread -...
1 vote
0 answers
79 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 ...
0 votes
0 answers
82 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 votes
0 answers
160 views
Call a method of a class to destroy the object that is calling it
I'm developing a game with Unreal Engine 5.4.4 and C++ using Visual Studio 2022. From a Character class I’m calling a GameMode’s method that will destroy this Character class that is calling the ...
Best practices
2 votes
4 replies
118 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 ...
Best practices
3 votes
1 replies
112 views
Architecture design for multilingual descriptions for several classes
I am creating an E-Commerce app. It has Category and Product classes. Both have multilingual descriptions, so, tables with title, description, meta-*, etc. and unique key (id, language_id). To add ...
3 votes
1 answer
82 views
In Laravel’s Repository pattern, should I pass an Eloquent model (User $user) or a DTO to keep it framework-agnostic?
I’m refactoring my Laravel application to follow a clean architecture approach with clear separation of concerns: Controller → Service → Repository The Controller handles the HTTP layer,the Service ...
-1 votes
2 answers
158 views
C++ design pattern for connecting templated and non-templated classes efficiently
I complete the implementation of a VM (ALU part) by adding operations to a Coprocessor. In this sense, I'm looking for a C++ design. Through a template, the VM is instantiated in 2 ways : A first ...