32,165 questions
0
votes
1
answer
119
views
How to retrieve the default notification vibration pattern in android?
As you can see in the NotificationChannel data below the mVibrationEnabled flag is set to true however there is no pattern included so the OS just plays the default notification pattern.
//////////////...
-1
votes
1
answer
45
views
Can a Single SPA UI interact with many Backends?
I'm working on a company project where the UI interacts with multiple different microservices instead of a single fronting api microservice. Is it the right architecture? We also have an Authorization ...
0
votes
0
answers
62
views
How to get all the subclasses of an abstract class in different files [duplicate]
I'm trying to apply design pattern to make it extendable and easy to maintain.
Here is my file structure:
/evaluation
│── metrics/
│──│── metric.py # abstract class
│──│── QWK.py
│──│── PCC.py
│── ...
0
votes
1
answer
314
views
Vertical Slice Architecture big number of models
I am playing with VSA and I encounter something that seams wrong. I want to build a Web Api using MediatR and CQRS. Now, let's say I want to implement some CRUD operation on an entity called User, ...
0
votes
0
answers
344
views
Redis Cluster Configuration for MGet
I am working on building a system which involves reading up to 100 keys in batch and have to adhere to strict latency constraints like p50 <= 0.2ms, p90 <= 0.8ms
The total number of keys for me ...
1
vote
1
answer
78
views
Override property from wrapper class
I have a class A with a property prop and a method method that uses this property:
class A:
@property
def prop(self) -> int:
return 1
def method(self) -> int:
return ...
0
votes
2
answers
87
views
Interface class with "variable" config structure in function in C++
I want to create an interface class for a communication interface - see source code. However, different interfaces (USB, COM, etc.) have different configuration options, so the Open( ) function must/...
0
votes
1
answer
65
views
How to avoid expanding a Request class when adding new consumers?
I have a system where multiple consumers (e.g., pricing calculators) process requests based on specific constraints. Each consumer has different requirements, meaning they only need a subset of the ...
1
vote
1
answer
104
views
How do I implement a lazy-loading Proxy for a Label interface with a const getText() method?
I'm having trouble properly implementing the Proxy pattern. In my project I have an abstract Label class (used as an interface) and its concrete children, such as SimpleLabel and RichLabel. Since ...
0
votes
0
answers
53
views
What design pattern to handle atomicity of data state with pyndatic models when reading/write the data from a storage database
I would like to discuss my design problem in order to evaluate what I am doing right and what I can do better to handle my current problem. To date I create Pyndatic models of business logics saving ...
0
votes
1
answer
95
views
Avoiding Self Referential Structs
I'm writing a program that operates on a Vault object. This Vault object contains a directories field which is a vec of Directory objects. So something like this
struct Vault{
directories: Vec<...
-2
votes
1
answer
98
views
How should I implement Fuzzing techniques presented in "The Fuzzing Book"? [closed]
I am currently reading "The Fuzzing Book" and I am trying to determine how I should apply or implement the fuzzing techniques that I have learned from the book. For instance, in the book, ...
0
votes
0
answers
25
views
Why is process.nextTick() used in this Task Queue implementation?
Why can't I just use this.next()? Why do I have to process it in the next event loop?
export class TaskQueue {
constructor (concurrency) {
this.concurrency = concurrency
this.running = 0
...
0
votes
0
answers
157
views
How to create and manage multiple class instances for reuse in a FastAPI application?
I have a FastAPI application that instantiates several services before application start and holds them in a global variable for reuse in several other modules, including several FastAPI routes. I ...
0
votes
0
answers
78
views
Design pattern for exit method with exception
I would like to exit from a method - started in a separated thread - with an exception when an external condition applies.
How to solve this without messing up the method itself with explicit checks?
...
1
vote
1
answer
104
views
Why is object creation have separate interdace in Factory Method Design Pattern?
I am studying design patterns and in an implementation in Java, I came across an example. My main doubt is why do we have to create a separate interface for object creation of the subclasses. Why can'...
3
votes
2
answers
174
views
Is instantiating a concrete HttpClient instance an incorrect use of Dependency Injection in .NET?
I'm trying to follow best practices to create loosely coupled code but I still need to have a deeper understanding of Dependency Injection.
So I was wondering if this code respect this concept since I'...
0
votes
0
answers
93
views
Configuring a email sender with FastAPI
{
"1-click": {
"template": "1_click.html",
"recipients": { "to": ["[email protected]"], "cc": ["manager1@...
0
votes
1
answer
48
views
How to use delegates in View member functions?
I am restructuring my project and I repeatedly bump into the following problem:
In my View structs I have functions that are executed from e.g. Buttons. Some of these functions need to use system ...
2
votes
1
answer
82
views
Is it mandatory for the visit methods to return void in the Visitor Pattern?
This is the Java example of the visitor pattern in wikipedia:
These two interfaces are at the core of the pattern:
interface CarElement {
void accept(CarElementVisitor visitor);
}
interface ...
0
votes
2
answers
96
views
Aggregate with many value objects
I've been reading "Implementing Domain-Driven Design" while looking at the code samples, but I'm not sure how to deal with aggregates containing a lot of value objects.
For example, this is ...
0
votes
1
answer
44
views
Abstract logic to avoid duplicate implementations
I need to abstract the following structure to avoid implementing logic that is executed in x twice in y. Below is the code structure.
A bit more specific: The first code part is used by a JSF ...
1
vote
1
answer
71
views
Type-safe template generator design
I am working on a stateless document generator service where multiple templates (such as invoices, reports, etc.) can generate documents in the same format (e.g., a Buffer). Each template has ...
0
votes
1
answer
74
views
how to compare lists with their frequency
I'm interested in finding similarities between two lists. I have the count of duplicates in the first column, and the pattern is in the second column. What would be the most logical way to compare ...
2
votes
3
answers
148
views
Accessing namespaces via iterators/pointers?
I am currently facing a design/language problem of sorts. I have 3 files, A,B,and C which have their own namespaces defined as A,B,and C respectively. Each namespace has exactly the same function ...
0
votes
1
answer
61
views
About the function configureServiceManager in class ServiceManagerConfig in ZF2
I am reading thre sources code of ZF2.I met the class ServiceManagerConifg.I can't understand the function of the Function configureServiceManager.
class ServiceManagerConfig implements ...
0
votes
0
answers
52
views
The Benefit of Command Pattern over direct Action Binding
There is something that I couldn't understand regarding the command pattern.
What is the advantage of using the Command pattern compared to directly assigning actions to buttons?
Let me demonstrate it ...
0
votes
1
answer
81
views
Accessing subclasses of a Class in Java
I am new to Java and currently learning about SOLID principles and design patterns. While trying to fully adhere to the OCP (Open/Closed Principle) and the Prototype Design Pattern, I encountered an ...
0
votes
0
answers
94
views
Design Patterns for Implementing Offline Support and Data Synchronization in a Blazor WebAssembly Application
I am developing a Blazor WebAssembly project that will be deployed as a web application with offline capabilities. The application should: Load data into browser storage (IndexedDB) when the client's ...
2
votes
7
answers
152
views
How to handle additional parameters for different implementations of an interface in Java?
I am working on a Spring Boot project where I have a Notifier interface with a send(String message) method. Different implementations of Notifier, such as FCMNotifier and SNSNotifier, require ...
-1
votes
3
answers
163
views
How can I make the factory class static in factory design pattern?
I was reading an e-book explaining design patterns, and after explaining the factory design pattern, it suggests some improvements. One of them was to make the factory static.
Make the factory (or a ...
0
votes
1
answer
59
views
why django makemigration command creates python based code instead of creating sql commands [closed]
why django makemigration command creates python based code instead of creating sql commands, Someone please explain from design decision point of view, and what benefits we get from it.
0
votes
3
answers
80
views
How to store structured data in a python package?
I'm currently developing a python package which among other things generates maps for a very low resolution driving game.
The maps are generated by combining predefined tiles. Those tiles have to be ...
0
votes
1
answer
94
views
Saga pattern to delete Client data and associated resources
I'm working on a system that allows associating attachments to different business entities, such as to a Client.
To simplify things, the system has the following database tables:
Client: Stores ...
0
votes
0
answers
53
views
What is the purpose of the DefaultValueFrom attribute in GeneXus Pattern instance XML definitions?
In GeneXus Patterns, within the XML definition of an instance, elements of the Attribute type (under ElementType) have two XML attributes: DefaultValue and DefaultValueFrom. Both are strings.
I need ...
1
vote
4
answers
166
views
Looking for a design pattern similar to IDisposable (and Using)
I have a class that has a Start and an End method. I want to ensure that whenever a begin is called that the end must be called. For example:
var foo = new foo;
foo.Start();
...do other stuff
foo.End()...
0
votes
1
answer
297
views
How to correctly implement of State Machine Pattern
I'm trying to implement State Machine Pattern for the state of a form, but I feel like it's not adding any convenience.
Context: user fills in a form on my webpage. User then saves the form. Upon ...
1
vote
0
answers
62
views
How to achieve this arc design in flutter
I am trying to create a custom design using arcs in Flutter, but I am unable to achieve the desired results. Here's what I have attempted so far:
I want to create a design similar to where the arcs ...
0
votes
1
answer
138
views
Interface method argument without a type - code smell?
I'm thinking about creating an interface method with an argument that can have a mixed type, to act like metadata. I don't know the metadata type upfront, but I know that some kind of it (or something ...
2
votes
1
answer
52
views
How to properly model the entities am i working with
I am developing an application which, among other things, defines the following entities:
There is a base class called "Action", with the following inheritors:
SimpleAction1, SimpleAction2 , ...
3
votes
2
answers
128
views
How to Implement a Custom Observer Pattern in Java Without Using Built-in Libraries?
I am trying to implement the Observer design pattern in Java without using built-in libraries like java.util.Observer or PropertyChangeSupport. I want to create a simple system where observers (...
0
votes
0
answers
56
views
Spring: Passing information down to child methods
Here's the problem I'm trying to solve:
I've got a number of entry points into my system. e.g REST endpoints, Queue listeners, and let's suppose more in the future. I'd like to set some contextual ...
0
votes
1
answer
71
views
how to transfer non-domain-object data to event handler
I've been diving into Domain-Driven Design (DDD) lately and trying to apply it to a project at work. However, I've hit a bit of a snag and need your advice;
We have an approval system. Employees can ...
1
vote
1
answer
84
views
From memory buffer to disk as fast as possible
I would like to present a scenario and discuss suitable design patterns to address it.
Consider a simple situation: a camera records to a memory buffer for ten seconds before stopping. Once recording ...
1
vote
1
answer
48
views
In a .NET design, how to combine services (dependency injection) and object with constructors?
We are redesigning an ASP.NET MVC application that has business logic in helpers. We want it to have DI services (passed to controllers by dependency injection).
We have 2 concepts that we don't ...
0
votes
0
answers
93
views
How to implement the newtype pattern in Julia?
This concept has a several different possible names which might be used to describe the concept.
"Newtype" usually specifically refers to the implementation of the strong type pattern in a ...
-1
votes
3
answers
66
views
The proper way to handling multiple user roles and 2 statues for changing logic and UI in React
i got a project has 3 users roles (parent - child - teacher) and each role has 2 different statues (booked - unbooked) that changes the UI and logic.
Example:-
the home header in the home page will be ...
0
votes
1
answer
36
views
Instancing subclasses programmatically
How would one instance a scene that is defined as a subclass, where the superclass's .tscn would be shared between all subclasses?
For a card-battler project, I am trying to make my codebase more ...
1
vote
1
answer
66
views
Mock subscriber of a threaded publisher in Rust
I am implementing an implementation of the Command Pattern where a subscriber would receive data from a reader thread and I have issues testing my implementation using Rust mocks. Consider this ...
1
vote
1
answer
147
views
Classes with interface but different arguments, how to solve? C++
I need to call a set of functions, but what functions are to be called isn't known at compile time. The user decides what kind of calculations he is interested in and then the program takes that input,...