Questions tagged [design]
Questions about problem solving and planning for a solution through software design.
5,106
questions
1
vote
3
answers
596
views
REST API design: how to represent users joining and leaving groups?
I'm designing a REST API in which users create groups that other users join and leave.
A user creates a group by making a request like this:
POST /groups
Request body:
{
"name": "...
-2
votes
1
answer
152
views
Is it possible to predict last 3 digits of a closing stock price? [closed]
So, i just start learning in AI field and i want to develop my skill more. So, i just curious is it possible to predict last 3 digits of a closing stock price? which mean the output result will run ...
0
votes
1
answer
61
views
How to design a table component that stores data and also includes HTML code
I am developing a front end application given a back end with some API.
The application has two similar views. Both views make use of a big table that's also used as a form . For example, in the ...
0
votes
2
answers
466
views
Microservices - create post for logged in user
I am working on a small project with microservices architecture in Spring Boot. As to not make unnecessary calls to users-microservice, I have duplicated some necessary User data (id, name, summary, ...
0
votes
0
answers
36
views
Design a Program which Forwards Work Pieces to Corresponding Modules
I am working on a program that will listen to a queue of incoming message and will process each message differently depending on the metadata of that message. The messages must be processed in order ...
1
vote
0
answers
650
views
Best way to store key-value pairs of different types in c++?
I'm reading values from a (PE) binary file. The values have a known length and position in the file and are stored with no padding (right next to each other). They store various types (int, long, ...
1
vote
1
answer
428
views
Validation in both controller and my service classes?
I use the Laravel framework.
I've got controllers, like CustomerActivityController, and I've got a service layer with services like CustomerActivityService.
Say I want to create a new customer ...
0
votes
0
answers
47
views
Refactor conditional multiple AND OR operations? [duplicate]
I have a piece of code where two objects (incoming request object and a profile object) are to be checked for matching conditions.
So the first method is as below where I check whether the profile ...
-1
votes
2
answers
293
views
Should I store non-editable items lists in a database?
Relational database is mostly used for storing editable user data.
But how about storing non-editable lists of information? Possible examples are:
GUI-related: main menu items, selectbox options, ...
0
votes
3
answers
266
views
Use aggregation like LSP in C++
I was reading about LSP (Liskov Substitution Principle) in a book called Clean Architecture: A Craftsman's Guide to Software Structure and Design. I have a question regarding how this would be ...
2
votes
1
answer
545
views
Properly "exposing" a variable from a class in Python
I have a Launcher class that manages (check if they're alive and if not respawns them, also starts, etc.) Clusters which are processes launched through the multiprocessing Discord module.
To post ...
1
vote
0
answers
1k
views
WPF Best way to create viewmodel from another viewmodel
Often I want to open a new window from within some view.
I see opening a window as view logic. So I don't want code in my viewmodel that creates/opens/changes windows or anything else that interacts ...
0
votes
2
answers
291
views
Is it a good idea to use database sequential id as a key in external key-value storage?
I use Postgres database to store user information. Some of that information is sensitive so it was decided to store that information in Vault. The user table in Postgres has id's generated by a ...
1
vote
1
answer
284
views
How can one combine two system architectures, say client-server and repository architecture?
I have a situation where I think it would be best to combine two architectures but I am not sure if this is possible or that it is a good thing to do.
By combining them I mean taking certain parts of ...
1
vote
4
answers
305
views
Is a flag for analytics a functional requirement?
Refined description
Because of great contributions, the description mutated as follows:
My application's purpose is to register customers into a system.
The requirement is: enable traceability for ...
1
vote
2
answers
93
views
How to deduplicate implementation details coupling to the host objects' actions?
I came upon a situation where multiple classes manifest duplicated logic. They all delegate to a worker object, but when interrupted they have to stop the worker.
class A {
Worker w;
public ...
0
votes
0
answers
59
views
Separating entity persistence from logic
So, this is probably a repeated question, but I couldn't find a question which solve my questions.
At the beginning of the year, I started as a Junior Java Developer in a company that is in the market ...
5
votes
6
answers
469
views
Unsupported concurrent calls, throw exception or log a warning?
Context
Let's say I have a navigation service that allows me to navigate to a page.
The Navigate method is async because an animation (about 250ms) is involved.
public interface INavigator
{
...
-1
votes
1
answer
152
views
What is the best way of sorting a list based on the relevance from another service?
I have a product listing service, and it will give a list of products for the logged-in users, and the list is paginated, with ten products per page. I implemented this pagination using MySQL LIMIT ...
0
votes
1
answer
117
views
Correct way to deduplicate conditional statements [closed]
I'm facing with problem that in every function (with serves as service for endpoint) I need to check what is value of query parameter (mode). I need to check it on many callables, E.g.
def create(self,...
-1
votes
2
answers
83
views
Using same validation from 2 places with a tweak in one of them
I'm calling a validation function from 2 places in my code, which perform a series of validations on the input I receive. As a result, the function outputs a list of all validations that broke.
My ...
0
votes
6
answers
256
views
How do I stop constant doubts on my code when programming? [closed]
I often find myself ovewhelmed by questions, I'll explain my self in a practical example detailing how I think about my tasks.
I'm often critized on how I approach the problems, and the general ...
2
votes
2
answers
248
views
What is the best way to compartmentalize complex logic problems?
I am working on a problem with lots of if-then-else calculations. I am trying to compartmentalize the logic to make it more maintainable and less error prone. But, as I try options, I don't see what ...
1
vote
4
answers
225
views
Dilema about having a Country, Province, City model separate Aggregate or in the same aggregate
We are porting an old monolith application and we are trying to apply the DDD concepts, we started looking for what we think are the Bounding Contexts of the application.
We have what we thought would ...
0
votes
2
answers
101
views
Design Review: Queuing tasks to add rows of data followed by task to send email
I need to send personalized emails to a filtered set of users (~100,000) on every fortnight. I am using Marketing cloud API for it. The way I am thinking of designing the system is as follows:
...
1
vote
1
answer
146
views
Implementing shared content in a system with several users
I am working on a system that allows users to track their musical practice.
The system allows users to create 'exercises' that store a few pieces of information like name, description and external ...
-1
votes
2
answers
259
views
How to deal with upsert PUT requests in a Spring Boot web application without crossing service and controller layers?
I've got a pretty simple web service that I need to add a PUT endpoint for that can handle upserts. This application is primarily a middleware layer to handle logging, caching and instrumentation in ...
-1
votes
1
answer
119
views
Smart pointer class choice: Simplicity vs. right tool for the job
I'm wrestling with a design choice question here.
I've got a class that needs a couple of semaphores. Semaphores are non-movable objects. Objects of this class however need to go into a vector (there'...
1
vote
2
answers
184
views
Should an entity know how to render itself or is it renderers job to figure out how to draw an Entity?
If I have a graph which consists of nodes like this:
class Graph
{
public:
...
int32_t width();
int32_t height();
const Node * getNode(int32_t height, int32_t width)...
3
votes
0
answers
91
views
Difficulty understanding how federation increases cache performance for databases?
I am studying system design for distributed systems and in this page (https://github.com/donnemartin/system-design-primer), one of the following advantages was mentioned for federation for databases ...
0
votes
2
answers
118
views
How to design relationships with constraints on subclass type?
I'm developing a full-stack Rest application following a narrative description of a working context. There is a class Job with two subclasses Job_A and Job_B. Job_A produces Report_A while Job_B ...
5
votes
2
answers
2k
views
Real time chat at scale
I have been looking at different solutions for large scale chatting solutions. I feel as if I understand 90 % of it but am turning to this forum to tie the knot.
I imagine running a bunch of message ...
-4
votes
1
answer
405
views
Pass a value to a class via a constructor or a method? [closed]
I'm newbie in Java and I have question. Pass a value to a class via a constructor or a method?
public class HelloWorld{
public static void main(String []args){
TextModifyFirstVersion ...
0
votes
3
answers
118
views
Identify Enhancements early as a QA
I am having a problem currently where product managers are raising improvements as bugs. Also, they expect us testers to catch them early. Our company doesn't have any requirement document and as QA ...
0
votes
1
answer
89
views
Best way to calculate profit/loss with historical data
Problem
I need to build a profit/loss graph for a mobile app. The api from which I can get the historical price data only allows me to retrieve 1 item at a time. If the user has 500 items that would ...
1
vote
2
answers
116
views
Instance of component inside a (non-instance) component. Does it make sense?
A colleague of mine did this UML component diagram to represent both the required/provided interfaces and the internal structure of the subsystems that compose the system we're working on:
(The ...
-1
votes
1
answer
100
views
Design: Designing a Status Tracking Tool
We have a robust set of micro-services available.
For simplicity, let us call the services
S1
S2
S3
S4
S5
For simplicity, think of the flow to be this.
S1 -> performs step1 (start step)
S2 -> ...
-1
votes
1
answer
481
views
Is it okay to return an object in a list endpoint according to REST API specification?
I need to add extra data to a list endpoint. Basically it is the list I want to return and an extra data. Like below
{
"results": [...],
"extra_data": {
"field": &...
2
votes
5
answers
406
views
Do db calls in constructors lead to more DRY code?
It recently came to my attention that its best practice to avoid database calls in constructors. I feel like this means you end up repeating unnecessary code, thus the code is less DRY?
For example, ...
-1
votes
2
answers
544
views
Dealing with multiple application instances
I'm developing an application (Java & JavaFX) that writes/reads data (a file). The problem is I don't want to restrict user to run only one instance (of my app) at a time, as I really can't think ...
0
votes
2
answers
131
views
How to infer the type of a CSV file from contents or headers?
We've got a few CSV file templates with different set of headers. In each CSV template there's at least one unique header and each template is meant for a different entity in the system.
Right now, ...
7
votes
4
answers
1k
views
How to provide logging to consumers of a NuGet package/library
I've been building a library (NuGet package as I'm in the C# world here) & I want to add logging so the consumer of the library can optionally provide some logger to the library. However, there ...
0
votes
1
answer
60
views
Design a non replayable endpoint for a service
I am trying something out in Springboot and stuck with a weird issue where I want to send some data from my frontend (react app) to backend (SpringBoot) and make that request non replay able by users (...
0
votes
1
answer
193
views
How can I split tightly coupled code in an OOP language?
So I've a class that is some kind of wrapper of a state machine for a multipart upload and it's database writes/reads. Everytime something is uploaded via REST basically the following happens
...
2
votes
1
answer
138
views
Data Ingest Architecture Advice
I have a requirement where we need to collect N different events and store them for analysis. I am having trouble coming up with a general architecture for this.
FINAL REQUIREMENTS
The end goal of the ...
2
votes
2
answers
452
views
Design of a modular application
I'm developing an application (Java) in a modular architecture. I have two approaches in mind and I'm not sure which one will be "better code" in case of maintenance and conventions.
I have ...
-1
votes
2
answers
123
views
Protocol Design robustness against corruption
I am currently in the design phase of a binary protocol which is intended to be agnostic of the transport layer, meaning it should work on top of for example websockets as well as serial device to ...
-2
votes
1
answer
195
views
Using search trees to expedite coding for rubik's cube solving algorithm [closed]
I'm a mechanical engineering student currently building a rubik's cube solver. I'd like to code a VSCode program (meant to interface with an arduino mega) that uses the basic CFOP method (solves cross ...
0
votes
0
answers
488
views
Best practice architecture to implement Spotify Auth for a Flutter frontend app and Node.js backend?
I am currently building an application that uses the Spotify API to work with a user's playlists. My frontend is a Flutter app, which is connected to the backend, that is built with Node.js. Currently ...
0
votes
0
answers
59
views
Best way to align multiple RESTful API's through an API gateway
We currently have a monolith public api which serves most of our api endpoints. This has introduced a bottleneck as the owning team needs to make changes to publicise anything new and other teams don'...