Questions tagged [design-patterns]
A design pattern is a general reusable solution to a commonly occurring problem in software design.
4,515 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
2
votes
7
answers
277
views
I'm looking for a design principle referring to using a system for it's intended purpose
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 ...
0
votes
1
answer
71
views
Best practices for serving encrypted files in Laravel?
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 ...
0
votes
6
answers
255
views
Design pattern for exposing different parts of interface to different entities
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 &...
0
votes
1
answer
133
views
Optimal way to avoid iterating through each row in a dictionary of data/arrays?
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 ...
1
vote
1
answer
128
views
Optimal way to match prioritized list of tasks with available workers
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 ...
0
votes
1
answer
85
views
Designing a Clean Separation for API Sorting Parameters and Database Columns
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'...
0
votes
1
answer
95
views
Designing a Scalable Caching Layer for User and Tenant Metadata in a Messaging System
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) ...
0
votes
2
answers
133
views
Is it better to pass a specific "context" object to handlers rather than the entire domain object?
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 ...
0
votes
0
answers
75
views
When DI goes too deep - what is another architecture/design pattern you should use? [duplicate]
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 ...
3
votes
3
answers
199
views
Is it good DDD practice to hide all the aggregate methods behind domain services?
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 ...
3
votes
1
answer
173
views
How should User behaviour depending on role be design as OOP
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 ...
-1
votes
1
answer
311
views
Pattern for a chain of unreliable steps
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 ...
2
votes
3
answers
137
views
Is this an aggregate in DDD? Is it unnecessary to group objects as an aggregate if there are no invariants?
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 ...
4
votes
1
answer
186
views
Holding state in a service class in MVVM
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 ...
3
votes
3
answers
472
views
Is it a good idea to wrap node.js package functions in a micro-service architecture?
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 ...