We’re rewarding the question askers & reputations are being recalculated! Read more.

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
1
vote
0answers
34 views

Python - Checking for errors [on hold]

How would I go about checking to make sure only valid results are entered/How do I create a loop that will continue to ask one of the questions until answered correctly? ...
-4
votes
0answers
63 views

.NET Core 3.0 solution - splitting or merging [closed]

I`m designing a .NET Core 3 application which contains: REST API Frontend (a Vue project) Some kind of task scheduling and processing services. Each has own little HTTP API for monitoring Each will ...
1
vote
1answer
44 views

How well does this ECS implementation follow these principles?

I'm currently learning about Entity-Component-System architecture Data-Driven design as a way to counter bad OOP design and optimize data fetching as a CPU friendly operation. I'm trying to write a ...
3
votes
1answer
135 views

Is this code SOLID?

I have recently learnt SOLID patterns and started practicing them. I did follow all the guidelines but was thinking for a final review from experts if possible. What is the code about ? It encrypts ...
1
vote
1answer
73 views

Parsing xml files, ideas to design my code

I begun to work for a company which do not have enough time to practice code review. As a beginner programmer I would like to improve my skills on real working cases. I have been asked to facilitate ...
2
votes
1answer
32 views

Find closest elements in an array relative to given index with a bias to distance from index and direction

This function determines which images should be loaded based on which image is currently in the viewport (array index), what direction the user is scrolling, and if the image has yet to be loaded. It ...
0
votes
1answer
52 views

Access a variable after several references

I have a team lead that used to write references in a single script then access it in every script. Like for accessing a variable he has to write code in this way ...
3
votes
1answer
34 views

Calculating direction based on index of array

I am comparing the index of the current component displayed in the viewport against an array of all the components on the screen to determine to direction the user in scrolling. Does this function ...
1
vote
1answer
49 views

MVC pattern in my Repair Shop application

I am currently learning Java programing by building real life business application for repair shops. I am posting this code so I can get critical review, and change my application architecture if ...
1
vote
0answers
39 views

Tree Structure using Composite and Visitor Pattern

I have the structure Corporation/Company/Facility/Storage and only Storage could be part of Facility, and Facility could be part of Company, and Company part of Corporation. My main problem is for the ...
2
votes
0answers
39 views

Is this an acceptable MVVM Model with IEditableObject implementation?

I'm trying to follow MVVM pattern in a VB.net WPF application, and I would like to implement IEditableObject. Is this code acceptable for an MVVM application? In ...
3
votes
3answers
112 views

Detecting overlapped boxes and the color of overlapped area in a View

Recently, I applied for a job that required skills in object-oriented programming. Although I have coded in Java at odd times, those were very small assignments. I have been mostly programming in C ...
1
vote
0answers
33 views

Pattern decorator with template class [closed]

I'm trying to create a generic class for decorator pattern. I successfully did it with the example code by metaprogramming: ...
2
votes
0answers
46 views

Implementation of SCPI for control of test instruments

I work with electronics test equipment. I like to be able to automate tests using their remote control interfaces. I have built a pattern, a few base classes, that I can apply to all devices that ...
-1
votes
1answer
34 views

update field when others fields are motifed [closed]

I have a class Installment and a method executeTransaction. The field totalBalance ...
5
votes
0answers
95 views

Extending VBA classes with Behavioral Patterns

I want to learn about Design Patterns and be able to apply them in Excel VBA. So to learn about patterns I bought a book that seems promising: Head First Design Patterns; it presents the material ...
1
vote
0answers
82 views

Clean way of passing parameters in swift

I am creating a user request model to pass-params for web service call toRegisterParams() is used call register web service request toLoginParams() is used call register web service request so my ...
4
votes
1answer
134 views

Factory pattern for creating embossing machines

I'm working on a program that creates a file for a specific embosser machine (machine that creates plastic bank card for example). I have 3 embosser machines and all of them create different files. ...
4
votes
0answers
51 views

Mapping abstraction? (Node JS) [closed]

There will be a huge object mapping (transforming) with a lot of calculations and logic for some fields. I would like to refactor this to classes or some kind of separation so it will be easily ...
5
votes
1answer
35 views

CandidateArchive for model-assisted multi-fidelity global search algorithm

For my research I'm working on global search methods where a candidate solution can have it's fitness (=score) evaluated in multiple fidelities (=accuracy levels). The goal of the ...
8
votes
4answers
453 views

DDD Architecture for an e-commerce website (uploading images)

Problem Description I am working on an e-commerce website, when a user wants to sell a product, he would open the product page and he can upload up to 12 photos: Image Upload Process This is the ...
3
votes
1answer
159 views

Consistent and extendable way to store data for session

I am making session store which will store some data and read some, This session store can store multiple data( SessionInfo) to the map. Data Structure ...
-2
votes
1answer
67 views

Is using generics like this a type of code smell? [closed]

Lets say I have the following interfaces ...
1
vote
2answers
62 views

Header file for accessing components globally in library

In my project I have a header file which contains only functions which are put into a namespace, the purpose of these functions is to be used from another class of the framework I'm working on, or ...
3
votes
1answer
214 views

Bank ATM Mockup App

This is a follow-up on bank ATM mockup app in .NET Core framework and Entity Framework Core. I have 2 user interfaces: Console and Web. Previously I have UOW and repository layer but I have removed ...
0
votes
1answer
61 views

Builder pattern in C# supporting subclassing with nested classes [closed]

[Posted yesterday on Software Engineering, but was apparently "disappeared"...maybe better here] Background: I am just starting to get my head around the idea of separating the domain model from the ...
16
votes
2answers
2k views

Singleton Design Pattern implementation in a not traditional way

For implementing Singleton we can use Traditional way like this Article, but i think that to write it in another way: ...
1
vote
0answers
60 views

What pattern can I use to write CRUD functionality? [closed]

I am writing a console application. CRUD functionality.I would like to try to apply the pattern. Is it possible to apply a "state" pattern? In the AddCustomer () ...
2
votes
3answers
110 views

Simple middleware pipeline builder (similar to asp.net-core)

I created a simple middleware pipeline builder that I want to use for my frameworks. It is similar to how ASP.NET-Core middleware works and uses the same conventions: A public constructor with a ...
0
votes
0answers
28 views

Server Design with GraphQL.Js

To learn graphql I'm creating a server for queries to a local postgres cluster. The pg cluster is populated with sample data from postgresqltutorial.com and I wanted to use GraphQL.Js instead of ...
2
votes
2answers
77 views

Logger adapter with a configurable chain of responsibility of middlewares

I use my own logger adapter that collects data into a dictionary: public class Log : Dictionary<string, object> { } This is really all I have. I then pass ...
3
votes
0answers
36 views

Adapter pattern to support multiple file storage systems

I am just getting in to following design patterns. I have create a class that allows for performing a couple operations on different remote storage systems: drive, dropbox, .etc (I call these ...
1
vote
0answers
27 views

Encrypted network protocol in NodeJS

This is just an exercise. I know I should not implement encryption protocol myself. I know I should use Node's TLS package. I know I do not authenticate other side, but merely encrypting traffic. I ...
1
vote
1answer
31 views

Adding Length dimension to a Crate Object

Consider Crate::addLength() in the following code: ...
4
votes
0answers
97 views

Toggle any application feature ON or OFF - follow-up (v2)

This is the second version of my FeatureToggle service (see previous question). It still has the same purpose which is to help control whether a feature is ...
-2
votes
1answer
53 views

Simple First Come First Serve Scheduling Simulator [closed]

My goal is to write a CPU Scheduling Simulator in C++ using the STL features as far as possible. So far, I have only written the code for FCFS and have not provided any input method. What sticks out ...
3
votes
2answers
132 views

Implement The Singleton Pattern for Persistency managers Swift [closed]

I am creating an iOS app and I want to implement Singleton Pattern. I have created "Singleton" LibraryAPI to act as an entry point UserManager object to get data from web API. after that I used a ...
5
votes
1answer
45 views

A view for Python list slices

As you probably know, Python slices like arr[1:3] etc. do NOT provide a view onto list and instead creates a copy of the list, what can be not optimal performance ...
-1
votes
1answer
78 views

Class Inheritance in C# (possibly generics) [closed]

I'm working on a segment of code where it runs a number of tasks and then combine individual task results to construct a complete task result object, there's no concurrency involved so it's purely a ...
0
votes
1answer
101 views

Abstracting an Email Notification Service & testing the the logic of the used abstract factory

In my application I have an Interface IEmailNotification that represents an Email and the concrete implementations have nothing to do with ...
1
vote
1answer
29 views

Command Design Pattern Implementation: Moving Robot with Undo-movement (Python)

I'm learning about the command design pattern and would like you to critique it for division of responsibility, especially with regards to how the robot "undoes" commands it previously executed and ...
3
votes
0answers
73 views

Object Oriented Chess Design In Kotlin

I know there's a similar question to this: See here. And I have taken the points mentioned there into consideration. However, I wanted to learn Kotlin and thought of writing OOP based Chess myself. ...
-4
votes
1answer
71 views

Is it a proper implementation strategy pattern? what's better to use enum or define? [closed]

The idea is that when we want to create an object of some type, we will only use a robotcreator and enum from the interface. the goal is to decides what type of robot to use internally, based on a ...
1
vote
0answers
44 views

Lightweight, modular Discord bot - tips and feedback on the code?

The full project is up on GitHub. The codebase is super small as it stands. I'm brand new to reactive programming and Spring, and would mostly like insight on those two things. Asynchronous ...
3
votes
2answers
89 views

Simple OOP currency converter - follow-up

This is a follow up question on this post This is what I changed on my previous code: I use Exchanger and PairCurrency class ...
3
votes
3answers
140 views

Thread-safe “singleton” that destroys object when not used anymore

I'm working on some legacy code which uses the singleton pattern. The problem I have with the traditional singleton is that the instance lives until the program terminates. This is messing up the ...
2
votes
1answer
49 views

Abstracting a SQL Server Table builder

I'm working with SQL Server 2008 and wanted to make table builder, similar to Laravel's migration classes. I would like to be able to expand this down the road but the main purpose of this code will ...
3
votes
1answer
76 views

Parsing Game Entities

Could use some help with my presentation in Software Development. I'm presenting how I reworked a game's parser (SpaceTaxi). Basically we take in a .txt file with ASCII characters and convert them ...
4
votes
1answer
86 views

How to group custom events [closed]

I have a number of custom events that a class might or might not subscribe to. ...
1
vote
1answer
45 views

Inter module communication

I have two modules, Notification which basically contains SignalR hubs and CoreSetup which contains core setup logic in it. I have a class in CoreSetup module which keeps track of employee location . ...