32,164 questions
0
votes
0
answers
42
views
How is the most ethical way to schedule Python to run N times a day?
a question regarding quality and best practices. In a system that requires many scheduled tasks, what is the "formal" way to handle this?
When there is a number N of automation services ...
1
vote
3
answers
1k
views
How to reduce the gap in TailwindCSS grid
I am using the TailwindCSS grid function to show the stats and their value.
I want to know how to decrease the distance/gap between the state and its value so that I can bring them closer to each ...
1
vote
2
answers
100
views
How to overcome when staments in Kotlin
Hey,
I think that I am not the only Android and Kotlin developer who has an “allergy” to when statements. The simple reason is that these statements often easily grow into some ugly code. For example:...
-2
votes
2
answers
100
views
Correct singleton pattern implementation? [duplicate]
I have the following singleton implementation based on a video https://youtu.be/Q6HJpgdkAK8?si=k-9ksjHirLHq5Ne2 Some features of my own implementation are different, but i want to know whether my ...
-2
votes
1
answer
73
views
Design pattern for Interface with implementing classes no longer requiring all methods [closed]
I have an interface AService which has 2 methods, and this interface is implemented by two different classes. One of the methods is directly called from an another service by calling on an AService ...
0
votes
2
answers
84
views
Understanding [GoF] Decorator design pattern: detaching responsibilities dynamically without recreating the whole chain
So, in my understanding, with Decorator pattern you can easily attach additional "responsibilites" (or more generally, behaviors) to an object dynamically. Usually the decoration chain is ...
1
vote
3
answers
107
views
What is this pattern called and is it a good practice? Strategy pattern?
I refactoring some Python code and one time I came up with a kind of pattern that I can not really assign a name (I'm not really familiar with patterns though).
Here is an attempt on an abstract ...
0
votes
2
answers
172
views
Is Directory to SubDirectory more of a composition or inheritance?
In object-oriented programming, there are two main relationships between objects.
Inheritance (is-a-relation)
Composition (has-a-relation / also called containment)
For inheritance, one can have a ...
0
votes
1
answer
86
views
Need a good pattern for mapping entities between two data sources
I'm stuck with a very simple problem I can't find a simple solution to. I am looking for an elegant pattern to map data between two datasource
SourceA SourceB
ClassA1 -> ClassB1
ClassA2 -> ...
0
votes
0
answers
62
views
How to avoid references to each other in Object?
I designed the following class for the game in production.
public class Character
{
public string Name { get; set; }
public List<SustainedAction> ActionsInParticiption = ...
-1
votes
1
answer
45
views
Does an additional service class violates Single Responsibility Principle?
Let's say I have implemented an Action Design Pattern, and I have these actions:
MakeJuice
MakeCoffee
MakeBreakfast
MakeDessert
now, for every actions, as it should, have their own set of ...
0
votes
1
answer
94
views
On the pros and cons of multiple nesting in React component development
I've developed a React application for a book library based on what I learned in my university classes. The application manages a list of books, allowing users to view, rate, and delete books. I've ...
0
votes
1
answer
113
views
Orchestrated vs Core use-cases in clean architecture
I have an endpoint that should create a book, and if it is the clients first created book it should send an email like "Congratulations to your first book". Following Clean Architecture I ...
1
vote
1
answer
75
views
Designing long running transactions
I have to conduct tasks 1-6 in an orchestrated async manner. every task has a receive queue and respond queue. These tasks are long-running...can take several days to finish.
The orchestrator is ...
0
votes
2
answers
125
views
Resolving a circular dependency in classic Controller-Service-Repo architecture
Our Rest service is a classic Controller-Service-Repository architecture implemented in Java with Spring. As described here, it helps with separation of concerns and unit testing.
Sometimes, our ...
1
vote
1
answer
98
views
What is the correct way to handle multi-db in nestjs with TypeORM?
I have two databases: a master database, which serves as a common database, and another database (dedicated to each tenant/customer) with the same schema. If you have experience with a multi-database ...
0
votes
1
answer
111
views
Best Practices for Optimizing Orders Products Data Retrieval in Microservices Architecture
In my eCommerce microservices app, I want to create a page to display the order summary. The order contains a group of products, each with its own ID. Should the front end make multiple requests to ...
2
votes
0
answers
44
views
How to improve Extensibility of adding sub-middleware in traefik custom middleware
I'm working on a custom middleware for traefik that serves as a base for other sub-middlewares.
Each sub-middleware implements an interface and has its own config structure. Here's an outline of my ...
1
vote
1
answer
749
views
Is this the Result Pattern / Operation Result Pattern, or something different (if so, what?)
Is this the Result Pattern / Operation Result Pattern? Or something different (if so, what?)
Result Pattern: From what I can see, the Result Pattern's intent is to return status, not substantive data/...
1
vote
2
answers
244
views
Dynamic field exposure based on user authorization in Spring Boot controllers
I developed a Spring Boot application where I have a set of controllers that connect to a common service layer. I don't mind using any protocol (REST, GraphQL, gRPC, etc.) for the communication ...
0
votes
3
answers
190
views
Connecting to AxonServer node failed: UNAVAILABLE: Network closed for unknown reason
While trying to connect to axon server using docker image of it:
version: '3'
services:
axonserver:
image: axoniq/axonserver:2024.1.2-jdk-17-nonroot
hostname: axonserver
container_name: ...
0
votes
1
answer
36
views
Dependency injection - data pass to dependency
I'm trying to learn and understand dependency injection. (python example below):
class Printer :
def print(self):
pass
class CSVPrinter(Printer) :
def print(self, data):
for i ...
1
vote
1
answer
61
views
Pattern to allow rendering server components within client components
I have a probably pretty common case where a Client Component (CC) uses the useState hook to conditionally render Server Components (SCs).
A CC will turn any component it imports into CCs, which in ...
1
vote
1
answer
96
views
Rust trait inheritance for a subset of the trait implementations
I'm not sure how exactly to formulate this question so I will illustrate by example.
I am using the bitflags crate which provides a trait called Flags. The flags trait involves the presence of an ...
0
votes
1
answer
38
views
When Dependancy Injection goes rouge in blazor
I have a blazor project that has a sperate Webapp UI and a mobile app UI utilising blazor hybrid principals, they share multiple components that display some data and allow actions to be performed on ...
0
votes
1
answer
84
views
How to manage nested schema's in event driven architecture and where to store them?
We are developing an IoT cloud solution with an event driven architecture.
The devices produce events and communicate with consumers through an event broker. All event messages are serialized in JSON. ...
0
votes
1
answer
116
views
Python Design Pattern Logger Class
Seeking for your advice, currently doing self studies regarding the Python Design Pattern. In chapter 2 I stock with this class. It has 2 module, logger_class.py and new_script_with_logger.py
for the ...
0
votes
1
answer
73
views
Restrictive access in the Subject interface in the observer pattern
In this observer pattern, there is one more thing I am using: a push-pull mechanism,
so there is a reference from observer to subject also.
so now when the Subject is part of the observer itself that ...
-1
votes
1
answer
75
views
Database queries buffer
I have the following requirement to fulfill:
When the database is unavailable, I have to write all queries into a buffer file (for ex. .PMQ) for later execution.
Caching database results is common ...
0
votes
1
answer
304
views
Long running backend tasks in a Kubernetes cluster
A Kubernetes novice here.
I have a simple client/server web application for video conversion:
The frontend uploads a video via HTTP POST, receives a response with a status check URL
The backend ...
0
votes
2
answers
132
views
How to iterate over different structs in C++ using a single function
I'm developing an Entity Component System (ECS) in C++ and I'm trying to find an efficient way to iterate over different component structs using a single function. Here's an example of my component ...
3
votes
3
answers
201
views
Avoiding switch-case statements in C#, where each case has different dependencies?
I'm working on a small hobby project with someone as a learning exercise. In it, the user traverses a dungeon, finding treasure, fighting monsters, etc. etc.
Right now, the approach looks a little bit ...
0
votes
1
answer
27
views
Pattern remote facade AND separated Interface
I'm studying design patterns for an exam and I'm stuck on a question:
Combining the Separated Interface and Remote Facade patterns.
The textbook we're using is "Patterns of Enterprise Application ...
0
votes
1
answer
67
views
Define API for multiple concrete implementations
I try to implement multiple concrete classes, which share the same API. The base functionalities between these classes are the same, but they support different types of configuration (among shared ...
0
votes
0
answers
44
views
DDD: Modelling different type of aggregates with some common behaviour and state (Not of transitioning nature)
I am trying to implement an HR management module wherein I have three 3 types of employees namely RegularEmployee, ReengagedEmployee, OutsourcedEmployee. All of them have some common properties like ...
2
votes
2
answers
143
views
Groovy loop through Pattern matches
def regex = 'crt1234[a-z]_(\\w\\w)_DTS(.*)'
Pattern pattern = Pattern.compile(regex)
Matcher matcher = pattern.matcher("crt1234_DH_DTS")
matcher.findAll()
How do I loop through ...
2
votes
2
answers
117
views
How to "mark" a function-like trait to be optionally executed in parallel?
Context
I have a predicate trait. It takes some type T and returns a boolean value for it.
trait Predicate<T> {
fn evaluate(&self, t: &T) -> bool;
}
I also have evaluator that ...
0
votes
0
answers
37
views
HttpClient with field & dispose or using statement across class methods? [duplicate]
Which example of using HttpClient in a class is preferable?
Set HttpClient as field and use across all methods in class with dispose:
public class HttpClientExampleRepository : ...
0
votes
1
answer
52
views
For using the files in other folder outside of dags, inside dags/ folder in apache airflow
I have the structure of folder as:
folder_structure
I want to use files which are present in deps folder in the dag files present in dags folder, how to do that?
Can someone please help me with this
I ...
0
votes
1
answer
79
views
Which methods to include in service class using service / repository pattern?
I am practicing using the Service / Repository pattern in a C# / .NET 8 app and have some questions about best practices.
Below is an example interface for one of the services:
namespace NCAAMB....
0
votes
2
answers
38
views
Name of design pattern creating the same object for equal arguments
It's a bit like the singleton pattern with the twist that one passes arguments when acquiring the object and are getting the same object if and only if the arguments are the same. Example in python:
a ...
0
votes
2
answers
120
views
How to build a module for logging in Python?
I want to write a library (a module) in Python for logging. The logger instance should be unique per process and global per process. (Meaning that it should not be passed around as an argument to ...
0
votes
1
answer
44
views
"Collecting" classes/variables from various files to simplify importing?
Suppose several classes are defined in multiple different files across a Python project, such as
mylib.somefile.Class1
mylib.somefile.Class2
mylib.anotherfile.Class3
mylib.athirdfile.Class4
...
What ...
1
vote
2
answers
89
views
If View Model property has value with certain length, replace it with query from database.Do it in Controller, Validation Attribute or somewhere else?
My View Model looks like this:
public class ProductVM
{
public string SerialNumber { get; set; }
// Other properties left out for brevity
}
In the form that fills this model, users can ...
0
votes
4
answers
63
views
Separation of concerns in business layer (usecases, services)
Let's say at the beginning I had a requirement where by sending a post request to my /posts API endpoint - post had to be created.
To implement this I created a PostsUsecases thinking about it as a ...
0
votes
0
answers
167
views
Pythonic way to create a singleton class that requires an async method to setup?
I'm writing a Python package that implements a class which should be a singleton.
The class is responsible for sending async http requests. Thus the class needs to have access to an aiohttp....
0
votes
1
answer
56
views
Where should database calls that return primitive types be located and who should be calling them, Application Services or Domain Services?
As far as I know Repositories should work with Domain/Business Entities. All the operations to save and retrieve data to create entities should go there, and then the Repository is used by the Domain ...
0
votes
1
answer
74
views
design pattern with Python -> abstract factory
I have implemented the abstract factory design pattern with Python and I see that it gives me the following error.
this is my code :
"""
Abstract Factory
- Abstract Factory Pattern ...
1
vote
2
answers
112
views
Architecture design for divide the subsystems
When you do architecture design, you usually divide the subsystems. Is there any methodology to divide the subsystems?
Are architectural patterns like hexagonal architecture, clean architecture, etc. ...
1
vote
1
answer
128
views
How functional approach of web app architecture looks like?
P.S. example is in kind-of-scala, but language not really matter, I am interesting in functional approach in a whole.
Usually I saw pattern like this
outer world -> controller -> serviceA -> ...