32,175
questions
0
votes
0
answers
8
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
0
answers
6
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
28
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
52
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 ...
0
votes
1
answer
37
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
0
answers
28
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
0
answers
46
views
How Hexagonal Architecture helps on testing? [closed]
After I've tried learning Hexagonal Architecture. In my understanding, the idea of port&adapter is just dependency injection in the type of interface injection and I'm just curious on how this ...
-1
votes
0
answers
26
views
Is there a way to send out an event request from a component and have a value be returned if true? [closed]
I'm making a 2D platformer because I wanted to be super original.
Anyway, I am creating a movement system and I want to make it a structure that is easily compatible between different enities.
//
The ...
-1
votes
1
answer
25
views
How best to structure crud operations in jetpack compose? (in terms of viewmodels) [closed]
I am building an app using jetpack compose using the MVI design, with a Ktor backend (connected via retrofit). as a part of the app, I have a screen with a list of "Clients", where I have ...
-1
votes
0
answers
26
views
Where to start/init connections in a Class? Constructor or seperate dedicated method?
I've encountered this problem for Redis, Database, etc, which involves making a connections with connection strings provided by user.
interface DataStorage<LockType, DataRef> {
acquireLock(...
0
votes
0
answers
81
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 ...
-1
votes
0
answers
43
views
Save Entity with relationship JPA code architecture
I am building a RESTful API in Spring boot. My architecture is the three-tier achitecture; Controller -> Service -> Repository.
I have 2 entities, Transaction and Invoice. This is a OneToOne ...
-1
votes
0
answers
29
views
Alternative to using a callback to signify the end of a process
I have this code, my focus is on the setIsSaveActionActive and setIsReleaseActionActive they are used to start and cancel the loading animation while processing.
Originally the callback was used only ...
-1
votes
0
answers
13
views
Write a program to plot a saw tooth wave in C
The detailed program question.
We need to print a pattern using loop and/or arrays and input height and width .
Column A
Column B
Cell 1
Cell 2
Cell 3
Cell 4
Column A
Column B
--------
--------
...
2
votes
2
answers
103
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
0
answers
16
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
51
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
26
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
41
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 ...
-1
votes
0
answers
18
views
Ports & Adapters: Driven Adapter becomes Driving?
A philosophical question about the Ports & Adapters design pattern:
We are building a system where the following happens:
1. A Driving Adapter picks up an event and calls the Domain Use Case (in-...
2
votes
2
answers
95
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
28
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
30
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
56
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
29
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
82
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
23
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
72
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
37
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
24
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
30
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
46
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
58
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
108
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 -> ...
1
vote
1
answer
28
views
Where should we do the filtering - at the data layer or the service layer to optimize testability and efficiency?
We use LINQ in EF to filter the data (to optimize queries). However, on testing our services, we cannot test the queries - so should we have filtering also done at the service layer?
0
votes
0
answers
64
views
Updating the Flet page on callbacks from multiprocessing processes
I'm trying to make a gui flet that would update when data changes in multiprocessing processes.
The problem is that the data is not updated in the gui. As you can see from the log below, all the ...
1
vote
1
answer
46
views
Large stored procedure unit testing best practices / general methodologies
I have been creating a unit testing system for our SQL Server databases using the tSQLt framework. In the early stages of this process I have started creating some basic unit tests for a few simple/...
0
votes
3
answers
64
views
Creating singletons of derived class from a base class
Hi i have a bunch of managers which are all singletons for each type that they manage, but i am wondering if i can reduce the annoyance having to setup the singleton logic in each derived class ...
0
votes
0
answers
11
views
Integration testing with different testing components .net
I'm facing the problem where I need to create integration tests based on components it defines, for example if I want to test kafka with in memory database, I should be able to do it but without ...
0
votes
0
answers
36
views
Adding multiple IAM tools in Angular/.Net Core application
We are developing a product using Angular 17 and .NET Core 6 Web API. For authorization and authentication, we plan to integrate external IAM tools such as Okta, Azure AD, etc. Given that each client ...
-1
votes
1
answer
48
views
What kind of design pattern is this?
I was going through a TypeScript repository today and I found all the classes were implemented in this fashion:
export class ServiceClass {
private static instance: ServiceClass;
private ...
0
votes
2
answers
32
views
How does Bridge pattern work with Spring Boot?
I am learning about the bridge Pattern using Spring boot and I'm using Chatgpt to help me with the process but I can't understand how it knows when it needs to use EmailSender in EmailNotification and ...
0
votes
1
answer
52
views
Abstracting a real hardware and simulated device with the same interface in Python
I am looking for a more idiomatic or concise OOP pattern to implement the equivalent of the following.
Interface and implementations
from abc import ABC, abstractmethod
from typing import override
...
0
votes
0
answers
21
views
How do import a component to my Angular app using the design libraries from a framework?
I'm trying to create a layout for a client with pre-existing angular components from their library. I have all my environment for Angular running in my computer and I included the libraries from the ...
0
votes
1
answer
31
views
What is the difference between "Event Gateway" and "Event Bridge" patterns?
In event-driven architecture there are two similar-looking patterns: event bridge and event gateway. I'm not entirely sure what's the difference between them, because they both seem to require a ...
3
votes
2
answers
83
views
OOP Design: should I use generics or polymorphism in the base class?
I have a question regarding OOP design.
I have an abstract class Converter that takes a list of Documents as input, processes them in a specific way, and returns a new Document. The Converter class ...
1
vote
2
answers
63
views
Angular Service Injection in reusable components
I have a reusable component, ReusableComponent, that needs to use a service that contains an specific function. This service must implement an interface, ServiceAbstraction, to make sure that it ...
1
vote
1
answer
41
views
Create multiple instances of an angular service
I have an odd requirement. Our's is a single-spa application. In which, the container app would give us a navigation menu on the left (Tree View), and we would create a new instance of the module and ...
0
votes
0
answers
32
views
Design Pattern for Handling Different Notification Types in a TypeScript Frontend
I am currently working on an application with the following structure:
Backend: Ruby on Rails
Frontend: Next.js with TypeScript
Real-time notifications via WebSockets
The notifications are stored in ...
1
vote
1
answer
39
views
Android app design recomendations for a alert dialog showing list
So I was doing an implementation in an app, and I wanted to show in the PlateScanner, the plates that the user has scanned.
Now it works, but the design is a bit, "off" hahaha
I´m not a very ...