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
-2
votes
1answer
353 views

Why EJB service Injection requires the specific subclass to be created?

Most Java EE guidelines suggest that we should define Abstract EJB services (APIs) and then define concrete implementations in order to conform with OO design principles. But at the injection point, ...
-2
votes
1answer
56 views

What method/ approach is used to query a user's page on a website using backslash + username? [closed]

I am working on a Servlet/JSP project, the website have users and I need to display a user's profile using the notation myDomain.com/Joe instead of myDomain.com/users.jsp?user=Joe. An instance of my ...
-2
votes
1answer
461 views

Producing Consumers Thread Pool

I’m coding a Hash-Life implementation in C++14 and working on a multi-threaded implementation. It has obvious potential for multi-threading. The task can be broken down into essentially 13 sub-tasks. ...
-2
votes
2answers
78 views

multiple uses for original software [closed]

How does a programmer figure out multiple uses or applications for the original software he/she has written. I am an artist who has designed a RPG game with several different and separate applications ...
-2
votes
1answer
511 views

What is design pattern/paradigm for ASP.NET web-apps? [closed]

I don't actually know if my question is correct, but working on a webapp porting from ASP.NET world to Java + Spring platform I came up with this question in mind. Using Spring MVC, the new version ...
-2
votes
1answer
126 views

To return or not - redundant data from method arguments

Which code should I prefere and why? Is there some general rule? Code 1: var apiLicenseInfo = GetLicenseFromApi(string userId, string deviceId); var localLicenseInfo = MapToLocalLicense(apiLicenseInfo)...
-2
votes
1answer
46 views

Inheritance and domain-specific logic loses its independency?

Im sorry in forward, Im sure I wont be able to express myself well. Its a game system: abstract class GameType { private $score; public __constructor($score) { $this->score = $...
-2
votes
2answers
126 views

Dependency of program code on specific database values

I have two approaches to solving a problem but I don't know which one is better. I will give a simplified example. First approach The database will look like this: color | -------- FFFFFF | 0000FF ...
-2
votes
1answer
80 views

Design pattern for a switching between APIs with no code changes

I'm trying implement in JavaScript/Node.js a data upload functionality. I want to be able to switch between different storage providers, e.g. AWS, GCP, Azure, with no code change, for instance, via ...
-2
votes
1answer
83 views

Adding unstructured data to a relational database (PostgreSQL)

I'm building a project and I only know the MERN stack. Everywhere I see the general consensus is that Mongo is not good and should only be used in very specific use cases. More importantly, I also ...
-2
votes
1answer
179 views

Creating one or multiple objects based on the input

I am designing the software to calculate employees' hours among others. To simplify my problem let's say that I have Activity class, which has a property Type. This type could be for example "Standard ...
-2
votes
1answer
72 views

Is this an example of a wrapper function?

I'm working on an application in python. One of the functions we have is called def createThread(user, status, title, ...): # some code here system.db.runUpdateQuery("INSERT INTO table(value,...
-2
votes
2answers
3k views

What is Difference between DTO and Response Object?

What is the difference between a Response Object and DTO in software architecture? Say I want to get a list of Products in a catalog. If ProductDTO is this, how is a Product Response class different? ...
-2
votes
2answers
71 views

How do I model all the different states of a widget for testing?

Say I am a QA person so I have no control over the complexity of the code in the following example. I have a datatable widget with many different filtering and searching options. All the columns on ...
-2
votes
1answer
224 views

Design patterns for migrating a legacy database model [closed]

I have a product which has a un-normalized legacy data model which contain millions of records. This has cause problems when adding new features and with performance. Also this contributes to high ...
-2
votes
1answer
475 views

Architecture Design Approaches for Metric Collection

We want to pull application and business metrics from the source web application to track billing, usage and performance of the application. These metrics are to be stored in a different database (...
-2
votes
2answers
47 views

Security of data viewed and altered by a web app

I am working on a system that needs to keep the data safe and not accessible to people without authorized access. The client is a web app that communicates with the servers via APIs. This is what I ...
-2
votes
1answer
174 views

Appropriate design pattern to get some info from different classes

I am working on one project which redirects user to custom page after login, registration etc. FYI, the custom page can be configured as per customer from admin settings. I am trying to follow some ...
-2
votes
1answer
984 views

What is a good design pattern for monitoring a protocol handshake? [duplicate]

I am writing a program for monitoring communications between a server and multiple clients on a network. In particular Websocket protocol based communications. I construct monitoring objects for every ...
-2
votes
1answer
404 views

Program to look at the first say 5 characters of a word and return a string if that string is actually the first 5 characters of a word?

For example, say I have a string and it has the letters: RDNAL This is not an actual English word or it doesn't start an actual english word, so the program would skip this string and would avoid it....
-2
votes
2answers
192 views

Calling blocking functions and execute code when result is ready, but without callbacks

I am designing an application that has some scripting capabilities: the host application may call the scripts to perform some operations when some events occur. To keep it easy and newbie-friendly, ...
-2
votes
3answers
327 views

terms for the html/css/javascript model?

Are there any words for the design model implemented by HTML + CSS + JavaScript, either for that specific set of technologies or any abstract pattern that they follow?
-2
votes
2answers
236 views

I have to run certain number of statements (which are executing .exe) in a loop

I have to run certain number of statements (which are executing .exe) in a loop. ForEach(object obj in ListOfVersions) { Step 1: call Exe1 Args=obj.somevalues Log Step 1 completed ...
-2
votes
2answers
280 views

Name for this pattern? [closed]

I'm writing a class that will handle thread synchronisation. It would have a begin method which would increment a counter and an end method that would de-increment a counter. It'll have another ...
-2
votes
0answers
24 views

Second service layer to manage transactions - Spring stereotypes

There are a few controller calls to my services that can trigger more than one transaction (if one operation succeeds, it will be persisted, regardless whether the next succeeds or not). I can only ...
-2
votes
4answers
127 views

Interface or Object with Type?

I have a calculation program which uses a number of different vertex types. Currently I have euclidean and geo, and I have decided to create an interface. Now I am wondering if that is a good idea. ...
-2
votes
1answer
87 views

What are the names of the following patterns?

Two different patterns: Acting on a single object by multiple services that can modify it as they wish. So basically we would have some kind of a "chain" that modifies a single object by ...
-2
votes
1answer
47 views

Design to method chain across packages

So bascially we have a library that contains a series of bifunctions passed in the metadata and datum looking like: Transform1: package transformation1; import com.fasterxml.jackson.databind....
-2
votes
1answer
112 views

What is the pattern called where you move a class' static properties to a separate class? [closed]

Personally, I call this the Blueprint Pattern; however, I am sure someone else must have already named it. Static members, are in most cases, not a good thing. In languages such as C# and Java, they ...
-2
votes
1answer
75 views

Design help needed

I have a model call Drug class Drug{ String drugId; String name; String strength; } this interface takes a drugId and returns the Drug Model interface IProcessor{ getDrug(String drugId) } // easy ...
-2
votes
1answer
143 views

Does this pattern have a name?

I have a large XML file that I extract information from. I am extracting the information using a list of classes with a main method of the type ParsedValue[] GetValue(BigXmlFile). This is a bit like ...
-2
votes
1answer
452 views

Email Content creation | Proper design

Working on an E commerce application where we need to send so many email to customer like Registration email Forget Password Order placed There are many other emails that can be sent, I already have ...
-2
votes
1answer
216 views

Programming Pattern - Single Data Structure - Multiple Methods [closed]

I have a single data structure that holds a relatively small amount of objects (ca. 1500) and several methods that are acting on it. Is there a programming pattern to iterate the methods over the data ...
-3
votes
2answers
480 views

Which data-structure or programming technique to use when?

While studying for Data structures and Algorithms, I noticed that there is a pattern/group in which every question falls into. Example - Given this, do/find that - Category 1. use these methods/...
-3
votes
2answers
105 views

Do classes that set, get and calculate data follow the S in SOLID?

Supposing I live in a country where every car brand has a different tax rate, and I have a base class called Car public class Car{ public string CarType { get; set;} public int Year {get; set;}...
-3
votes
1answer
178 views

What are the best practices for writing a long, multi-step process? [closed]

When writing a long process, i.e. one filled with many steps of business logic, what are the best practices for organising it? There are a few different options here that I can see: Just write a long ...
-3
votes
3answers
333 views

How to design a solution that needs dynamism using Inheritance [closed]

I have below code/classes/interfaces: An Interface: public interface Animal<A extends Animal<A>>{ void fight(A otherAnimal); } 2.Tiger class which is implementing Animal public ...
-3
votes
2answers
410 views

How do you hash 4 doubles into a size_t?

I have bounding boxes the key type. Box { double mins[2]; double maxs[2]; } And I want to have Box as the key type in the D programming language, so I have to implement: size_t toHash() const @...
-3
votes
2answers
260 views

Design for a plugin based application [closed]

I am working on application, details of which I cannot discuss here. We have core framework and the rest is designed as plug in. In the core framework we have a domain object. This domain object is ...
-3
votes
2answers
85 views

What are some use cases for creating child processes? [closed]

I am trying to understand processes and their use in software engineering. Not processes in general but rather creating a process from within a program. It seems a really powerfull tool and i have a ...
-3
votes
2answers
92 views

Seeking appropriate design pattern(s) to describe most function-based mathematical problems

I have been looking for a good, general design pattern to implement simple mathematical structures where functions have the following properties: know which parameters they contain, parameters are "...
-3
votes
1answer
107 views

Taking over a project. Should I scrap and rebuild? [closed]

I'm taking over an Opencart solution for a client. This is for my capstone at College. I'm to create a simple CRM (Customer Relationship Management) software that will live as a single page ...
-3
votes
1answer
905 views

Is there a pattern to map a range of numbers to a string?

I need a function that will take the name of a town and return a specific range of numbers that is assigned to that town. I won't be using a database. The simplest way to do this is //Pseudocode ...
-3
votes
2answers
83 views

What Design Patterns for encouraging component reuse?

One of the major issues that I am facing as a Website and App developer, is that certain components / features have to be redeveloped over and over again with a new project. For instance login, signup,...
-3
votes
2answers
286 views

Is this an anti pattern in Javascript?

A common pattern I've been using for JS/NodeJS applications is the following: import { utility1, utility2 } function exampleScript() { utility1() utility2() // Does something } Basically my main ...
-3
votes
1answer
60 views

Convention for exception argument order [closed]

Just a quick question about a design pattern for creating custom exceptions. The question is more about the order of parameters. If you can specify more data in the exception, should the parameter for ...
-3
votes
1answer
131 views

What kind of factory method abstract singleton design pattern is this?

I made a code that seems to mix Singleton design pattern, and Fatory method. But my factory method is in an abstract class inherited by my Singleton ... what the hell have I created ? Does it have a ...
-3
votes
1answer
181 views

Is throwing exceptions in Debug mode a bad idea? [closed]

I am working in an iOS project which have two schemes enabled from configurations, Release Debug As you know Debug scheme is used for developers while developing features and testing etc. However, ...
-3
votes
1answer
148 views

What is an integration test pattern for an extensible permutation of cases (e.g. dimensions of seed data and filtering by said dimensions)?

Suppose we have a service that returns users in certain categories, e.g. Listens to a certain artist. Listens to a certain playlist. Listens to a certain genre. Is between ages X and Y. Is located in ...
-3
votes
2answers
91 views

Which should control the design of application software, Language or Framework or Domain? [closed]

Recently i have been looking more into the design part of application programs. The suggestion seems to be very different across different sources. For example the books like code complete suggest to ...