Questions tagged [design]

Questions about problem solving and planning for a solution through software design.

Filter by
Sorted by
Tagged with
1
vote
2answers
58 views

How can I write an enum for date periods where not all periods have a static number of months?

I have an enum that works very well to represents date periods and the number of months in those date periods: public enum StandardDatePeriod { ONE_MONTH(1), SIX_MONTH(6), ONE_YEAR(12), ...
1
vote
3answers
43 views

Keeping business logic separate from data access

Let's say I have few entity classes: class EntityA { LocalDate date1; LocalDate date2; } class EntityB { } class EntityC { LocalDate date1; } and I want to pass them through some logic containing ...
0
votes
0answers
49 views

How to handle missing, damaged and extra items in an inventory [closed]

We have a small and basic inventory module in our system. Now we have to manage stocktaking, I mean adjusting the product quantity because of missing, damaged, or extra items. As inventory management ...
0
votes
0answers
33 views

Overloading vs another method for concrete example [duplicate]

Suppose, we have a create method: public void create(MyEntity entity, Foo foo, Bar bar) This method creates entity. Now, we need a method to create entity and lock it. And I see two solutions here - ...
0
votes
1answer
32 views

Designing for many third-party REST API integrations

Not sure if this is the right forum for this, but I've come across a need for this pattern a few times lately, and I would love to get some opinions on options for how to handle it. Say I have an app ...
1
vote
2answers
42 views

System design for concurrent operation at one level with ordered operation at another

There are two logical entities, Customer and Account where a Customer is associated with one or more Accounts. How to design a system that ensures Customers can update their Accounts concurrently, but ...
0
votes
3answers
82 views

DDD - storing and retrieving entities of an aggregate from the outside

In my doctor's appointment booking system, I identified the following entities: Doctor Patient Appointment I also identified an aggregate, which is Doctor (aggregate root) and Appointment. It's an ...
3
votes
3answers
262 views

Is there any language where you can re-call the constructor on an instance of a class and any reason why not?

Is there any language or language feature where you can re-call the constructor on an instance of a class and is there any reason why you don't want to do this? For example, //let's say you have this: ...
2
votes
2answers
153 views

What methods can be used to simplify mathematical expressions?

For fun, I would like to design a mathematical expression evaluator, with variables. It could simplify the entered expressions by factoring them, reducing them to a sum of simple fractions, ...
0
votes
0answers
45 views

Handling multiple events in Event Driven Architecture

Let's say I have Service A that publishes Message 1 to be processed by Consumer A The same service A that publishes Message 2 to be processed by Consumer B I need to make sure that consumer B ...
0
votes
1answer
47 views

Expose or consume API REST?

I am preparing the software architecture for my client project based on APIs REST The idea is that any data exchange between my client and his partner will be via API REST call The specification is ...
0
votes
2answers
119 views

How to share API between microservices?

Currently, our architecture uses "API-first" approach in building our product. This product is divided across multiple teams handling different microservices. The above image succinctly ...
0
votes
1answer
116 views

C# is it acceptable to create a generic class and use an enum as generic type?

Abstract The case: Application contains a lot of views with a list of data. Data views (lists of records) have pagination, filtering and sorting options. The user must be able to select a "...
0
votes
2answers
69 views

Data structure for graphs and vectors in C

I'd like to design an implementation for graphs in C. I'm wondering what the most efficient approach in terms of both computational power and memory consumption would be. I've looked at various open-...
1
vote
2answers
80 views

CQRS: Is it an antipattern if the Command invokes a database interface which contains business logic?

Martin Fowler states that, Command module executes validations and consequential logic which aligns with every CQRS demo app that I've studied. That is to say: validation -- does this Jedi exist? -- ...
1
vote
1answer
176 views

How to do MVC in C++

I have a QT application with a window of OSG written in C++. I want to implement the app using MVC design. The application allows you to add markers to OSG model and it is using QT to edit the markers....
1
vote
1answer
94 views

Any workarounds to split functionality from the class?

Hello everyone)) I am working on the react application, where mobx is being used for the state management. Some time ago I have added such class: class EventLogStore { private _eventLogRecord: ...
2
votes
1answer
128 views

REST API noun vs verb and client vs server responsibility

I'm trying to delineate the responsibilities between client & server. I have the server parse a file, and then send back the uncategorized accounting transactions. The URL looks something like: ...
0
votes
1answer
56 views

Best practice to create model objects in Java

I have an existing microservice that talks to a Natural Language Processing (NLP) product and fetches around 50 fields. I need to create domain objects in Java now from these fields. I read about ...
1
vote
1answer
78 views

Design a function that indicates significant deviations in response times

I'd need some feedback on how to approach the design of a function that highlights parts of a time series chart. The chart shows the response time of an application, in particular the 90th percentile, ...
0
votes
3answers
151 views

Ingest data from our partener : API POST vs Event Driven Architecture

I am in the process of carrying out a software architecture for my client, in fact THE HISTORY OF THE REQUIREMENT : MY PARTNER SEND cvs files via MFT to MY CLIENT , many times a day . MY CLIENT has a ...
-2
votes
0answers
32 views

Design Pattern for this specific case study [duplicate]

I have been trying to use design pattern for particular case study. But I am stuck applying design pattern for this particular problem where a company is tasked to make a notetaking software. User ...
2
votes
2answers
226 views

Is a good practice to have multiple databases running in the same machine in production?

So I am developing my own DBMS as a resume project, but I am so deep now on this that I am even considering in the future to release it as an open source project and receive feedback from the ...
2
votes
1answer
52 views

Handling deployment of a stateful service?

For fun, I'm developing a multi-player card game. I plan to run it on a single cheap VPS, so deployment would have to kill the process and re-start it with the new code. There is no Load Balancer. I'm ...
1
vote
1answer
59 views

Intuitive RESTful API design for logistics shipments availability, accept, allocation decision?

I am trying to model APIs for Create shipments Fetch Available shipments (based on region preferences) Accept shipments (allows logged in user to accept multiple shipments on first come first serve ...
1
vote
2answers
109 views

Designing UI module for an application

I have an UI module that will expose only one class - UserInterface. The class will be responsible for collecting user input and providing output (command line UI style). From logical way of thinking, ...
-2
votes
1answer
58 views

How changing the video quality works while watching video online?

How does changing the video quality works behind the scene? Suppose I am watching a video on youtube (I will use YT as an example in this question) and suddenly my internet speed becomes slow, in that ...
-4
votes
1answer
58 views

Calculate math function depend on N value [closed]

I have method with the following prototype : R[] = method(k,n) which : n = ordinal value 0 <n <10^9 k = math function depend on n value : i.e n^6 R = array of computed values For example : n = ...
2
votes
2answers
95 views

What pattern for translation is better, naming the key by screen/context or by text?

I'm in a dilema where I'm translation a full mobile app where the translations are going to be a key value pair but I'm not sure how to name the key. Should I name the keys describing what the text is,...
-2
votes
4answers
135 views

Do logic on the backend or front end? When handling the results of a “wizard”?

We are creating a SPA, and thus the frontend is more than just a view for backend generated pages. Now to create an "entry" you normally press create, and then fill in the data for that ...
0
votes
0answers
45 views

Designing a proof mechanism

DataModel contains a Proof that contains all the information of its integrity along with the method with which the Proof should be verified. In this case I designed a JWS type of proof that can be ...
10
votes
5answers
3k views

Pros and cons of representing routes as legs or stops?

What are some pros and cons of representing routes as legs or as stops? A leg is a departure and arrival location, a departure time and a duration (or an arrival time and a duration). A stop is an ...
0
votes
2answers
109 views

Design: Tying behavior to state

I have the following (hypothetical) setup and am wondering if anyone has design suggestions, keywords, or nudges. I have a class Walk that implements a method doActivity. This method keeps track of ...
-3
votes
1answer
39 views

Serving content to authenticated users

I'm wanting to store lots of data in cloud storage - like S3. I want some data to only be accessed by authorised users, one way I could do this is to authenticate the user on my service, download the ...
0
votes
1answer
45 views

How should I handle dealing with a stream of incoming data?

I'm creating a NodeJS application that receives a ton of incoming financial data (prices) through Websockets, like anywhere from 1 to 5 data points per second which I would then like to send to the ...
0
votes
4answers
297 views

How do I decouple this coupled application?

I currently have this Bot Viewer application Which consist of the application itself - the Bot overviewer, which depends on a library Bot.Core. Within Bot.core we have defined the core interface for ...
-1
votes
1answer
36 views

Designing a class implementing a method which signature types depends on the instance contained

My goal is to define a Service class which process method accepts a RequestType argument that is defined by the contained ServiceType and returns an object of a type defined by ServiceType. By doing ...
3
votes
2answers
442 views

Where to store the results of a class internal computation?

Let's say I have a class with some suitable instance variables which are then used for some computation (via a method of the class). As the computation will generate lots of data which needs to be ...
0
votes
2answers
117 views

Method that is aware of interface underlying type without reflection

I'm struggling with the design of a method CallSystemX() that needs to accept a parameter of multiple Types. To get around it I created an interface called IRequest to be able to pass different types ...
1
vote
1answer
70 views

Visitor pattern applicable ? - Applying rules to a list of registrations

I have a list of Registration's, on which I need to apply a set of rules to each individually. Rules can be a single Rule, or a sequence of rules, representable by a tree. One rule is a ...
-3
votes
2answers
78 views

What design pattern / class / interface should I use for encapsulating a program? [closed]

I am building a chess - related application, and I want to use a pre-compiled program called Stockfish as my chess engine. I am wondering what is the best practice to encapsulate the usage of the ...
-2
votes
1answer
89 views

Achieving loose coupling

My scenario involves the following classes: I have three types of Peer that creates a RegistryType instance because its methods are needed. Same for Identity class. Each PeerType need 0 or all the ...
0
votes
0answers
36 views

Mediator design with a circulator dependency

My project is web related, and the intent is that I am decoupling two pages worth of actions so that each class would have a list of actions on their page, and if any action so happens to navigate to ...
-3
votes
1answer
88 views

What are some of the good and bad aspects of this basic design? [closed]

I made this design for a university assignment, but I am genuinely interested of this design's good and bad aspects. The design was supposed to be an OOP design. The system is meant to be an online ...
7
votes
4answers
535 views

Why does the C++ standard still allow uninitialized primitive variables?

If reading uninitialized memory is undefined behavior anyway, why has the C++ standard not been changed so that objects of primitive type (int, unsigned, float, double, bool, char) get default-...
4
votes
3answers
184 views

CQRS: getOrCreate - is this a command, query, or both?

Consider the following scenario: If the user isn't registered in the database, register them. Return their ID. If the user is in the database, return their ID. The API endpoint for this may look ...
2
votes
2answers
144 views

Difference between facade and orchestrator in the context of microservices

Suppose we have 2 microservices - service A and B. These two services are independent for most parts and API client talks to them directly. However, their functionality overlaps or intersects in some ...
1
vote
1answer
127 views

Enforcing changing rules in a board game - how to do it?

I'm trying to code Star Trek The Dice Game. The basic concept is you roll dice, which become different types of crew (Science, Medical, Command, Engineer, etc...) and you can "spend" crew to ...
0
votes
1answer
189 views

Does it make sense to reuse microservices in a desktop application with an “offline” mode?

Lets say we have a microservice architecture consisting of: multiple frontend clients, e.g. an Android App, an iOS App, and a Javascript Web Frontend a Java Spring (HTTP Rest) microservice to access ...
0
votes
1answer
158 views

Sharing form validation rules between backend and frontend (Having single source of truth)

I'm currently working on a web app using ASP.NET Core (C#) on the backend and Next.js (TypeScript) on the frontend. I have a lot of forms that need to be validated and I don't want to write validation ...

1
2 3 4 5
95