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.

0 votes
0 answers
35 views

Deque implementation around strategy design pattern (after second thought)

After the recommendations from the responses of Deque implementation around strategy design pattern (second thought) the java.util.Deque implemented through plain ...
user293682's user avatar
-5 votes
0 answers
126 views

Deque implementation around strategy design pattern (second thought)

On a second thought, the Deque implementation around strategy design pattern changed with a new implementation of retainAll method according to the solution from ...
user avatar
-4 votes
1 answer
89 views

Deque implementation around strategy design pattern

Implementation of java.util.Deque interface based on string of POJOs, that is plain old java object, encapsulating a field for holding reference to each object ...
user avatar
-3 votes
0 answers
62 views

Deque implementation around visitor design pattern

Implementation of java.util.Deque interface consisting of linked state objects (called Dual) and two sets of visitors (one for ...
user avatar
11 votes
4 answers
2k views

Builder pattern in Rust

I tried to implement Builder pattern, a popular design pattern for constructing objects consisting of different components, in Rust. Here is my attempt: ...
kiner_shah's user avatar
6 votes
3 answers
1k views

Game Design Patterns Command implementation

I started reading the GameProgrammingPatterns book and wanted to implement the command pattern. ...
Hrant Nurijanyan's user avatar
5 votes
1 answer
243 views

ReportManager design — ownership via move or unique_ptr, SRP concerns, and O(1) lookup strategy

I’m practicing the Single-Responsibility principle with a small project. A Report is composed of ...
sam's user avatar
  • 379
-1 votes
1 answer
111 views

Am I overusing classes and/or OOP features? [closed]

I have a very class heavy approach to writing C++ code, which I don't think is necessarily wrong. However, I often use classes without knowing if I actually need them, which I feel leads to making ...
user290523's user avatar
4 votes
1 answer
121 views

Maze game from book Design Patterns with smart pointers and polymorphism

The Design Patterns book chapter 3 about Creational Patterns starts with a maze game. They use the maze as an example throughout the chapter and instead of rooms they have also things like enchanted ...
elehtine's user avatar
  • 165
9 votes
2 answers
432 views

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
  • 190
4 votes
3 answers
373 views

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
  • 355
4 votes
2 answers
536 views

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
0 votes
1 answer
75 views

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
1 vote
1 answer
128 views

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
  • 37
4 votes
2 answers
141 views

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

15 30 50 per page
1
2 3 4 5
96