Questions tagged [design-patterns]
A design pattern is a general reusable solution to a commonly occurring problem in software design. Use this tag for questions when you're having problems with the implementation of design-patterns. Please don't use this tag on questions about text pattern matching. When using this tag on implementation heavy questions - tag the code language the implementation is written in.
design-patterns
32,152
questions
0
votes
1
answer
41
views
How to instantiate Singleton objects for other classes in a different class in Java?
public class Singleton {
private volatile static A AInstance = null;
private volatile static B BInstance = null;
private Singleton() {
}
public static synchronized A ...
0
votes
0
answers
4
views
R function/package to find frequent consecutive patterns in bunch of sequences
So let's say I have a bunch of sequences consisting in series of numbers going from 1 to 25. (for example (x<- (1,16,2,2,3,6,18,16)). I just want to find in all those sequences if there is frequent ...
-1
votes
1
answer
15
views
Choosing Design Pattern between DB and Web App
I want to choose a design pattern for the next scenario:
We have one database and one web app, for certain users I want to scramble one of the columns of the database.
Currently, we think Proxy is the ...
-2
votes
0
answers
16
views
Design patterns for file system [closed]
I'm working on a web app to import a file, validate it and save to db and the user can apply search, but I'm lost with the appropriate design pattern
I have a problem in finding the design pattern so ...
0
votes
0
answers
43
views
Design a Data structure ~(simple rate limiter) [closed]
I'm studying DSA for my interviews && university exams and kinda stuck right now.
There is a problem statement: given n(limit of request) and m(window time), design a data structure that ...
1
vote
3
answers
74
views
Dependency injection or static class for helper class?
In most of my project I usually create a static class containing all the functions I use all around my project.
But when it comes to unit testing i feel like there's a big flaw in my design since I ...
0
votes
1
answer
45
views
What problems can I have with spawning a set of new threads from Servlet and what alternatives exist?
For simplicity, I will omit some details and try to highlight the main point:
I have a servlet that consumes users' requests, when a user sends a request I need to gather data from many endpoints. One ...
0
votes
1
answer
73
views
Input Manager as a Singleton? [closed]
I’m creating a game with C++ and SFML, and i am writing an Input Manager to do stuff like hold a container with callback functions and load Bindings from a file. Is it a good idea to define the Input ...
1
vote
1
answer
62
views
How to design events and event handlers system using generic in C#?
I want to create an event system in my ASP.NET Core backend using generics for ease of creation and registration of handlers.
The main problem I encountered while trying several solutions was generic ...
0
votes
1
answer
18
views
Archtecture/Design pattern for communication between asyncio and non-asyncio context
I am writing a TCP-based client which do both req/rep pattern communication and push/pull pattern communication. I tried to employ asyncio and its transport/protocol structure to handle the low-level ...
-1
votes
1
answer
36
views
Is there any design pattern or way in Javascript that can be used to display some of the fields in nested JSON array
Below is the nested array of objects that needs to be displayed as a table. Currently, map is used to loop through items to return another array of all the elements required to display.
{
"...
0
votes
0
answers
8
views
Whats the purpose of these 4 registers in AXI4 Lite ? logic [31:0] control_reg; logic [31:0] status_reg; logic [31:0] data_reg_0,1
whats the purpose of these 4 registers in AXI4LIte? although we already have internal registers, and what does it mean to do write and read transactions for these registers?
I tried to understand ...
0
votes
0
answers
28
views
Designing a multiple async/await system that is error resilient and retry capable within a multi iteration loop
I am designing a system in nodejs where I am handling 1000s of rows of user data. Each row of data will have a multiple async/await call chain to a third party endpoint, where response at each step is ...
0
votes
0
answers
15
views
Is Async Call Applicable when there is a single rest call?
I am implementing a simple project in Python where I make one Rest call to fetch some JSON response, manipulate that response, and display the result.
Step 1: Make a Rest call, get a response
Step 2: ...
0
votes
0
answers
22
views
Is there a pattern for signals with arguments?
With the recent blow up of signals in almost every major js ui framework, there is one part of it I don't fully understand:
Say for example one wants to create signals for cached Rest queries.
My ...