Skip to main content

Questions tagged [design-patterns]

For questions requesting extra attention to be paid to the usage of design patterns in the code.

9votes
2answers
332views

Simple LRU cache implementations in C++20

LRU cache is a classical design pattern frequently questioned in programming technical interviews. It is best illustrated with pictures. Here are two examples. The following are two alternative ...
bobeff's user avatar
4votes
3answers
329views

numpy array/item handling functions

Recently I have been using numpy arrays, which have great utility via their broadcasting methods. I am attempting to write a useful public facing library, and this ...
Konchog's user avatar
4votes
2answers
520views

Simple Java program to aggregate lines of a text file

I have just written a small application to aggregate the lines of a text file, for example to group the lines according to the frequency of IP addresses in a log file. Would the code be sufficiently ...
Tobias Grothe's user avatar
0votes
1answer
62views

Bulk conditions evaluation throwing a single RuntimeException exception

Bulk conditions evaluation throwing a single exception of a configurable type for all unfulfilled conditions. It is developed around several design patterns: (1) fluent interface to configure the ...
user avatar
1vote
1answer
110views

Database design using Closure Table for tagging system

I created these database tables with the inspiration in NjDevPro github repository. The design uses Closure Table for implementation of hierarchical tagging system in ...
xralf's user avatar
4votes
2answers
111views

Managing file paths in a python Data Science project

When doing Data Science projects, I often have to load data and metadata, and output results, plots, logs, etc. Therefore I have to handle all the file paths from where to load the input and write the ...
Alessandro Cesa's user avatar
3votes
0answers
53views

Structure of nested Divs with a table

I'm a new frontend programmer. I'm making a web site with flask, and to be honest, I don't know much about front-end so I don't know if what I'm doing is best practices. In one section, I have a div ...
Enzo Bs's user avatar
5votes
2answers
124views

Argument Order To Determine Order Of Output (Python; `attrs`)

Feedback Request Is the manner in which I use attrs adequate (i.e. designed well)? Should I not expect to be able to use argument ordering to order the joining of ...
R509's user avatar
  • 262
1vote
1answer
88views

[Spring Boot][REST] Design Pattern Best Practice (Single Entity, multiple business logic implementations)

I have some problems regarding best-practice design between data source layer(Entity), domain layer(Service) and presentation layer (controller): I have one entity with a type field in the database to ...
user287004's user avatar
0votes
1answer
111views

Refactoring Agreement Status Logic: Applying SOLID Principles and Separating Logging/Auditing with Decorators

I have some production code that contains a lot of repetition and mixes business logic with auditing and logging. I've made two attempts at refactoring it, primarily using decorators. I'd like to get ...
KJanek's user avatar
4votes
1answer
104views

Sequentially bidirectional find the indexes of an element into a collection (after second thought)

The util class to find all the indexes on an element into a Collection supports forward and reverse lookup starting from a given index along with changing the ...
user avatar
3votes
2answers
196views

Data pipeline that handles errors and cancellations

I have code that concurrently reads data from a stream, processes elements, and writes the data to another stream. Each of these individual operations may fail, in which case I want processing to halt ...
Will Beason's user avatar
6votes
0answers
150views

Replacing tags in email

I have multiple tables and multiple email templates which will need tags replacing. The data for the tags depends on the recipient id as the data will need to be fetched from different tables. I have ...
Ben's user avatar
  • 61
3votes
1answer
157views

Mail Client - Displaying email details for selected JTable Row

I'm trying to write a very simple IMAP email client in Java. There is one table per account with multiple multiline rows. The last selected row of one of the tables should be displayed in an extra ...
Tobias Grothe's user avatar
6votes
1answer
109views

Service Locator C#

I made this service locator to be used on my game projects, but it uses pure c#. Basically, new services needs to inherit from the common IService interface to be registered. I also added events to ...
Thomas's user avatar

153050per page
close