Skip to main content

Questions tagged [design-patterns]

A design pattern is a general reusable solution to a commonly occurring problem in software design.

Filter by
Sorted by
Tagged with
0 votes
0 answers
25 views

I'm developing a library in JavaScript (TypeScript, actually) which is split into several modules. It's meant to run both on the web and in non-web environments like Node.js. The library is meant to ...
Blue Nebula's user avatar
1 vote
4 answers
165 views

I'm working on a Spring Boot application with a VoucherService and VoucherController. I currently have the service method return an ApiResponse<T> directly, like this: @Transactional public ...
Conquer the world's user avatar
-3 votes
1 answer
184 views

Is there a name for this anti-pattern? A reference to a class member is being passed to another class method, rather than having the class method set the class member directly. public class ...
Jeff Roe's user avatar
2 votes
2 answers
304 views

I have a data aggregation function that collects statistics from multiple sources. The problem is that whenever I add a new metric, I need to manually update the code in three different places, which ...
Tank's user avatar
  • 37
1 vote
1 answer
255 views

We have a CAD software extension, where you can draw products like walls, doors, windows, etc., and you can export the drawing as an order, which contains the parts and costs. As part of this export, ...
Divan's user avatar
  • 369
2 votes
7 answers
360 views

Recently a junior team member was asked to use a survey tool to act as a system by which fuel delivery drivers could submit their Bill of Lading to our dispatch team for record collection after ...
David Stratton's user avatar
0 votes
1 answer
95 views

I'm building a Laravel-based web application that functions as a personal online photo archive. Each user uploads and manages their own private collection of images. These images are encrypted at rest ...
TimoFran's user avatar
0 votes
6 answers
300 views

In a certain program I would like to have three objects, say, a, b, and c, with c being a shared private member (sub-object) of a and b. The data between the three objects shall only go this way: a &...
Alexey's user avatar
  • 958
0 votes
1 answer
158 views

I have an excel macro that imports daily share price files, and finds the highest price for a share after a given date. Each of these daily stock price files has ~1000 rows of data. Currently I have ...
Frankie139's user avatar
1 vote
1 answer
155 views

Problem Match prioritized tasks with suitable workers. Details Consider a task with following properties - type and size. Based on task type, tasks are prioritized. While a worker has following ...
Ammar's user avatar
  • 123
0 votes
1 answer
95 views

I'm working with a data mapper called UserMapper and a User model. Currently, UserMapper has a method called find_many. Now, a client makes requests like /api/users?sort_by=+last_name,-birthdate, so I'...
Dante's user avatar
  • 161
0 votes
1 answer
114 views

I'm developing a microservice-based application that processes a high volume of messages. Each message must be handled according to the user’s personal settings and some tenant-specific (customer) ...
GeekChap's user avatar
0 votes
2 answers
159 views

I’m designing a system where various “handlers” apply business rules to an object. Initially I had each handler receive the full domain object: // A large domain object with many properties and ...
nicke7117's user avatar
0 votes
0 answers
76 views

I like using dependency injection but sometimes I find that I have to nest some dependencies so deep that I would almost rather use a global variable (despite this being bad practice). Here is an ...
Leftover Salad's user avatar
3 votes
3 answers
255 views

I'm working on a DDD-based system and was researching the best way to handle domain services and keep business logic consistent. During my research, I came across this insightful quote from Steve ...
Mr_Sure21's user avatar
3 votes
1 answer
194 views

Imagine I got user which might be either author, administrator, reviewer An author have relation on book that he wrote. An administrator have relation on banned user (we track which administrator ...
Vincent PHILIPPE's user avatar
-1 votes
1 answer
328 views

I would like to refactor some code of a process that must perform a processing. The processing involves several steps, each of which can fail or go well. If successful, it must proceed to the next ...
jordan1982's user avatar
2 votes
3 answers
168 views

Below is a scenario that needs to be modeled using the Domain-Driven Design (DDD) approach. A Project can have Notes added to it. A Note cannot exist without a Project. A Note needs to be viewable ...
EMN's user avatar
  • 795
4 votes
1 answer
206 views

In my SwiftUI app, I have a UpNextManager view model and a service class called UpNextService which contains many methods to read up next items from disk, write them to disk and much more. The service ...
User95797654974's user avatar
3 votes
3 answers
495 views

Our development team works with a micro-service node.js architecture. This means we work with a very large amount of repositories that currently each take care of their own dependencies. To avoid ...
dreagan's user avatar
  • 147
3 votes
1 answer
169 views

I am currently working in a project where we are utilizing kafka as a Message Queue. We have two use cases here, one is to consume the messages in parallel, no ordering of any kind required. And one ...
Akshansh Jain's user avatar
4 votes
2 answers
723 views

I just learned about the Functional Options pattern in golang. what are the benefits of using it over just allowing to pass a config struct and just overriding the default values provided in the ...
moshevi's user avatar
  • 149
3 votes
0 answers
264 views

I'm working on a project that uses an in-house library, which is also used by other projects. There are some classes and methods in other classes that are not used outside the library itself, is there ...
ulitosCoder's user avatar
1 vote
3 answers
315 views

In a CQRS architecture, at least as implemented by Vaughn Vernon in IDDD_Samples, the query services lives in the application layer. But then where and how should authorization be handled? For example,...
Kyle Richards's user avatar
3 votes
3 answers
402 views

A common DDD wisdom I encounter online is that your repository should not return more than one aggregate type. But I came across this passage from Vaughn Vernon's book "Implementing Domain-Driven ...
Kyle Richards's user avatar
3 votes
5 answers
1k views

Specifically, I mean code structured in a way where storage is global. Bare with me, as my terminology is all over the place. If I want to create a variable, I "load" it into a global cache. ...
Scene's user avatar
  • 149
0 votes
1 answer
249 views

In Vaughn Vernon's book "Implementing Domain-Driven Design", he talked about repositories that allows you to query for partial aggregates using a "use case optimal query": (from ...
Kyle Richards's user avatar
2 votes
3 answers
320 views

I'm currently reading "Implementing Domain-Driven Design" while going through the code samples, but I'm having trouble modeling aggregates that stores a huge list of value objects. For ...
Kyle Richards's user avatar
2 votes
3 answers
325 views

I have a Slide class with subclasses referring to the different types of slides (IntroSlide, SummarySlide, etc.): abstract class Slide { String slideType; final String title; final String ...
Hello's user avatar
  • 47
21 votes
5 answers
4k views

I'm developing an enterprise-grade warehouse management application for a chemistry laboratory. A critical feature involves mixing multiple stock solutions to create new solutions based on predefined ...
Biowav's user avatar
  • 321
1 vote
3 answers
312 views

I am building a c++ project that will allow users to essentially model and create their own fleet of cars. Right now, the approach I have in mind is a Car Factory Class that will implement all of the ...
J K's user avatar
  • 27
2 votes
3 answers
1k views

I've been considering the way to solve this problem for a while, and I'm currently stuck between two options I both feel are suboptimal. Here's an abstract example of what I'm dealing with: I have a ...
pulpicated's user avatar
2 votes
3 answers
438 views

I try to brush up on my technical interview skills as I plan to seek a better offer I don't recall being ever asked that really, but I still want to clear up any confusion. What is association, ...
Sergey Zolotarev's user avatar
-2 votes
1 answer
216 views

I'm working on an ASP.NET Core application that requires handling multiple types of a single entity. Each type has its own properties and validation rules, which has led to confusion and complexity in ...
Marko Sami's user avatar
0 votes
1 answer
260 views

I'm working on an ASP.NET Core application that uses Identity for user management. I have an AccountService with a Register function, where I accept a RegisterBaseDto that contains the role ...
Marko Sami's user avatar
1 vote
2 answers
205 views

I've been reading articles on Hexagonal, Onion, Clean Architectures, and other Domain-Driven Designs. A common theme they emphasize is decoupling components. From what I gather, this means the UI ...
Saurabh Batra's user avatar
2 votes
3 answers
550 views

Imagine I have a factory that must create object based on unknown input (let's say user input). class Base; class MyFactory { static unique_ptr<Base> CreateBase(Input& input); } Now this ...
sayanel's user avatar
  • 509
2 votes
3 answers
275 views

I have an application, which contains a logger. The logger already exists and is ready to be used, so it can be passed directly to the constructor. class App { private readonly logger: Logger; ...
404 Name Not Found's user avatar
1 vote
2 answers
698 views

I've just started in a new job and the company use Mediatr to handle all requests in their ASP.Net controllers. I just can't see the benefit in using this pattern. I can see negatives but I'm ...
Mog0's user avatar
  • 147
0 votes
2 answers
131 views

I'm trying to make a utility Master class for aws client, and have mainly come across 2 types of commands/operations. Ones that require the S3Client, and others that do not. Therefore, I divided the ...
haxwagores's user avatar
1 vote
0 answers
95 views

I am developing a mobile application, and one of the features is a "story" that is essentially a series of screens. The screens can be of three main templates: A "video" template ...
AbduAdd's user avatar
  • 19
-2 votes
1 answer
237 views

I am currently developing a microservices architecture consisting of two services, and I'm facing a challenge related to transaction management and error handling. Microservice A: This service is ...
Oleg Pro's user avatar
0 votes
1 answer
253 views

I find the name data-oriented design very confusing - it sounds like data-driven development (letting hard data determine decisions in development) or data-driven programming (control flow determined ...
Sir Nate's user avatar
  • 111
2 votes
4 answers
449 views

Suppose a class needs multiple properties of the same type. I don't want a big constructor where the user can mess up the order of args (remember, they are of the same type, no compile-time errors) ...
Sergey Zolotarev's user avatar
1 vote
1 answer
402 views

Reading the Proactor pattern paper, specifically this part: I/O Completion Ports in Windows NT: The Windows NT operating system implements the Proactor pattern. Various Asynchronous Operations such ...
codefast's user avatar
  • 179
3 votes
6 answers
615 views

EDIT: This post has a single question but a lot of context. The single question is if there are downsides with the approach I'm taking over the common Visitor pattern. I've been thinking about the way ...
AFP_555's user avatar
  • 423
5 votes
1 answer
337 views

I see this pattern a lot, especially with countries, or more generally regions. An enum is defined with additional fields and with methods that translate to and from these values. Example: import ...
user2740's user avatar
  • 159
1 vote
1 answer
316 views

Question: What are common architecture patterns/strategies of updating user data (think of XML/Json/sqlite/custom binary format) when the format of the data needs to be changed, and when that change ...
GameRaccoon's user avatar
3 votes
5 answers
812 views

According to Why should I use dependency injection?, "dependency injection" has some advantages, for example: "Non dependency injection" version: public class Client{ private ...
wcminipgasker2023's user avatar
2 votes
1 answer
174 views

I have a Spring Boot REST API that will copy content from one Amazon S3 bucket to another. The source and destination buckets are specified in the body of a POST request sent to the API. This works ...
Space Cadet's user avatar

1
2 3 4 5
91