32,170 questions
-5
votes
0
answers
43
views
What would be the best architecture for a python library that simulates thermodynamic processes? [closed]
I am working on a library in Python for my company that will be used to calculate thermodynamic properties of mixtures in flasks. It should be extensible in terms of the calculators it uses for ...
Best practices
0
votes
1
replies
57
views
Where should "is this supported by our product?" flags live — on the data DTO or on a dedicated service?
I'm looking for a second opinion on a design decision.
No right answer expected - curious how others reason about it.
Context:
We have a multi-tenant platform. Each tenant is tied to a country, and ...
Advice
0
votes
2
replies
83
views
What is the name of this caching pattern
I implemented this pattern in two ocasions, not sure if there is fancy name:
instead caching the result of a query for a given id, I run a periodic scan and fill the cache, to serve all ids from ...
Advice
2
votes
2
replies
122
views
How to implement a Strategy pattern for different pathfinding algorithms in Python?
I am building a simple grid-based game and I want to implement different pathfinding behaviors for different types of NPCs. For example, some should move using A* (for efficiency), while others might ...
0
votes
3
answers
165
views
How to refactor multiple if-elif statements into a Strategy pattern in Python? [closed]
The Problem: I am building a simple data processing tool. Depending on the file format (JSON, XML, or CSV), I need to apply different parsing logic. Currently, I’m using a long chain of if-elif ...
Best practices
1
vote
1
replies
53
views
DIP is justified when I have at least three volatile inputs /outputs to/from some system, is this ok generalization?
I'm computer engineering student who is new in the realm of design patterns, for some reason I started with Dependency inversion- higher level policy should not depend on lower-level policy, but ...
Best practices
1
vote
3
replies
134
views
Decorator Pattern with DI
I'm learning about design patterns and I stumbled upon the Decorator pattern. I did my research, and implemented a working version.
public interface IWriter{
void Write(string text);
}
public ...
Advice
0
votes
2
replies
112
views
Designing a Python API: list of coordinate tuples vs separate parameters?
I created a Python toolkit called `cartons` that wraps RoutingPy and OSRM.
Currently, my API looks like this:
cartons.route(lon1, lat1, lon2, lat2)
For version 1.2.0, I want to support multiple ...
Advice
0
votes
7
replies
120
views
Is it considered an anti-pattern to use nested static classes for service commands and responses?
I am structuring the command and response models for my service layer. Currently, putting all models into a single, flat folder (like /commands or /responses) is becoming hard to manage due to the ...
Best practices
0
votes
3
replies
140
views
Is using Singleton pattern in Python viable for global Configuration object?
I've read quite a bit on SO and elsewhere on Singleton being anti-pattern (hard to test, thread unsafe etc), e.g.: https://www.michaelsafyan.com/tech/design/patterns/singleton
However, there still ...
Best practices
0
votes
0
replies
34
views
next js reuseable apiservice cofig
i am building a Next.js application using the App Router and I want to implement a clean, scalable, and reusable API service layer. My goal is to avoid repeating fetch logic in every Server Component ...
Best practices
2
votes
2
replies
58
views
"A Philosophy of Software Design" vs "Grokking Simplicity": how do you decide on their contradicting advice on function design?
I would like to ask you to help me clarify a situation regarding two different coding philosophies. Tell me whether they don't in fact contradict and I am missing something, tell me whether these two ...
Best practices
0
votes
0
replies
83
views
Best pattern for Mapstruct updater when a field can't be constructed/built without parameters
A simple mapper which also provides and 'update' mapper
@Mapper(componentModel = "spring", uses = "EngineMapper.class")
public interface CarMapper {
CarEntity carDtoToCarEntity(...
Best practices
0
votes
1
replies
57
views
How to implement idempotency across multiple servers with non-shared databases and private caches?
Server A → DB1A
↕
Private Cache A (Redis/Memcached)
Server B → DB1B
↕
Private Cache B (Redis/Memcached)
Problem
I have a POST endpoint (e.g., domain registration) where the client sends:
{
...
Best practices
0
votes
0
replies
52
views
Architectural pattern for binding user authorization to demonstrated comprehension before system execution?
In many distributed systems, user authorization is treated as sufficient proof of intent.
Examples:
Clicking “Approve”
Signing digitally
Submitting a confirmation request
Triggering a smart contract ...