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
-3
votes
2answers
52 views

Are design patterns built upon design principles? [duplicate]

Are the following statements correct? Design patterns are some techniques that follow design principles. Design principles are the underlying principles of design patterns. They are different things, ...
1
vote
1answer
97 views

What design pattern to implement notifications for a .NET application?

I have an ASP .NET web application dashboard that is used to send notifications to several .NET desktop clients. The current implementation is that the web app writes the new notification to a ...
-1
votes
0answers
57 views

how to read go interfaces [closed]

I been learning to program by reading tutorials and playing around by myself but when it comes to more "conceptual" questions it is hard to find answers. For example a few months ago I ...
1
vote
1answer
66 views

Loose coupling vs transparency in visitor pattern that visits composite

I have a composite object (I will call it A) that has fixed number of sons (I will call them A1 and A2) All of them have an Accept(Visitor) method. I have a GUI, A is the main window that consists of ...
-1
votes
1answer
56 views

Implementation strategies for dynamically scheduled tasks

I have a varying number of tasks. New tasks can be added, some tasks can be removed. But those operations happen rather infrequently (once or twice per week, and adding is more common than removing). ...
1
vote
0answers
65 views

Scalable architecture design for managing data flow in C++ using an Observer design pattern

What I need I need a suitable and scalable solution to manage data flow between the classes in my C++ program. Why I need it Upon new feature requests, I'm continually adding new classes to the ...
1
vote
4answers
126 views

Architectural problem for class combination (cartesian product) for save format strategy

Hello to everyone and thank you for any suggestion. I have a family of subclasses of Track (Track is abstract). Every concrete Track has a different number and types of fields (attributes) that extend ...
-3
votes
0answers
52 views

Designing a factory for differently shaped types

I have a .json file on file system, which contains an array with multiple object types, something like: { "data": [ { "type": "type1", ...
1
vote
2answers
84 views

Checking the user in almost all use cases

I have a web application that has Users that belong to Companies. A User can only belong to 1 Company at a time and they can manage their own company information. I'm using java spring and I'm ...
0
votes
2answers
44 views

Approach for using multiple implementation of one interface for a single class, optional to use all or most of them

Consider an interface: interface Auth { fun doAuth() } this can be implemented for multiple APIs: class GoogleAuth : Auth { override fun doAuth(){ throw NoGoogleAuthImpl(); } } class ...
0
votes
1answer
56 views

How do I implement a domain entity behaviour that depends on some external infrastructure?

I am in the process of developing some software using CQRS, ES and DDD. A part of the system is writing services for controlling devices and collecting data from them. Consider a "Start" ...
-1
votes
2answers
128 views

Robins magic Chess game: Where to put/split the behaviour to full fill Law of Demeter [closed]

So now i have a really concrete example; its highly related to that question here: Tell one, but ask the others? the important statements there are: In the comment section https://softwareengineering....
-1
votes
1answer
73 views

Different composition techniques from the perspective of the client

There exists different composition arts/techniques, i will present in the following some of them. The question then is do you know more techniques additional to my presented ones? And then the ...
-1
votes
3answers
200 views

Design pattern for creating and scheduling tests/exams

I have an Exam class that represents an examination/test: public class Exam { public int Id { get; set; } [Required] [StringLength(maximumLength: 30, MinimumLength = 1] public string ...
0
votes
2answers
78 views

How to determine whether (and how) my design should use inheritance, composition, decoration and/or strategy

I want to create a little todo app, with a "pedagogic focus" on clean software design. I spent some time reading about design patterns lately and I am trying to wrap my mind about which of ...
-4
votes
1answer
67 views

Design a login system

I have a task of designing login system with the requirement below: If the user login over three times, lock account for the first 5 minutes. The next failed 3 times login-in will lock the user ...
0
votes
0answers
28 views

Internal behavior VS external behavior with the count of method-parameter

Inspired by my own question + a fragment of Robert Bräutigams answer there: Tell one, but ask the others? i came up with this question here: let's take us the write method of a chatroom or any other ...
0
votes
2answers
68 views

Is there a common Python pattern for the scenario “run code, save the output and load it on a rerun”?

I've been using different ad-hoc variations on this, especially in numpy / pandas / data science-y applications. For example let's say I've done some intensive processing that outputs a numpy array ...
-2
votes
3answers
184 views

Feasibility of a service oriented concept for a device architecture

Assume a device using Raspberry Pi to control some hardware. This diagram tries to clarify the components: SOA concept feasibility is being explored right now. The motivations are: Components in ...
-1
votes
1answer
76 views

Design Pattern for accessing data over RestAPI calls

I am looking out for a general design strategy or pattern designing various components in my client application. Here are high level details: The data is accessed my making a RestAPI call. The data ...
-1
votes
0answers
69 views

What is the best way to map the json response to Java POJO models?

I am currently working on a spring boot api Java project which returns a JSON response from a rest template call. I am in the process of mapping the JSON response to my api POJO(DTO objects) which are ...
0
votes
1answer
49 views

Memento Pattern:Philosophy of createMemento() method in Originator class

I've question about the philosophy of createMemento() in Originator class in Memento Pattern. My teacher said: now that Originator class no longer stores Memento objects internally, we should give it ...
0
votes
1answer
28 views

Interfacing with records on remote DB from localhost Application Logic

There are times when I have to fix/update records on a Production and/or Staging environment for a Web App. These are remote DBs. Rather than push application code to fix the data, I've been "...
0
votes
0answers
10 views

Adding API wrapper to Vue project - any advices or recommendations?

I'm starting a new project that consists of backend (REST Framework - Django) and frontend (Vue app). First I'm trying to figure out the "best" way to handle API requests. For example - not ...
-2
votes
2answers
76 views

PHP Design Pattern, separation of concerns: should the Controller make a new HTTP request to the API?

I'm having a huge doubt on how to connect the front-end of my application to its back-end. So my application has a single entry point where all requests go. The request is dispatched to a controller, ...
0
votes
0answers
34 views

Pipeline pattern for MVC based GUI application?

I've got an application that uses MVC to run individual, isolated scripts to support our office. There is a root application will open new windows (limit 1 per tool) for each tool opened and each ...
-3
votes
1answer
69 views

Pattern for mass action with pre-checks?

Given a collection of objects and an action id (there is a corresponding "action controller" class, which can be found with the id), what is the best way to organize mass action on the ...
1
vote
4answers
193 views

Software-design for algorithm engineering

I'm currently working on an program that solves a graph optimization problem. I know the "standard" software-design principles like information hiding, modularization, etc. What I'm ...
0
votes
1answer
81 views

How to use an API key without knowing it?

let's say I would like to create a service like eToro that allows people to trade stocks but with their own brokers. If I do it just for me, it's pretty straightforward: create logic that replicates ...
0
votes
1answer
27 views

implement a dynamic frontend UI based on roles

We want to build a new frontend for our existing app with elements shown or hidden based on a users role. Are there any common patterns for this? I see two ways of doing this. The backend sends the ...
-3
votes
0answers
53 views

How to resolve coupling between two systems?

Let's say there are two systems that are communicating via an API. A is an ERP system which provides an API with dozens of required fields to create orders. B on the other side is a mobile app which ...
0
votes
3answers
392 views

Tell one, but ask the others?

Consider we have three classes which want to collaborate, then, where is the behaviour? I guess it can only be in one of the three classes or in a fourth one acting than as a procuedural connector-...
0
votes
0answers
39 views

Multiple endpoints but share the business layer

I am looking at a code base that has multiple APIs and traditional server rendered website. The business logic is duplicated between each of the APIs. I would like to clean this up and share the ...
-2
votes
2answers
60 views

Where to place exception handling while using Decorator design pattern

How to design a service layer structure that will be resistant to exceptions. Let's say I have a simple OrderService service, this service performs basic operations - saving an order. public interface ...
4
votes
1answer
150 views

Dependency Injection: What are advantages of using a framework? [duplicate]

Introduction and Question I understand what the advantages of dependency injection, e.g. constructor injection or setter injection and that it is one way of doing inversion of control. I also ...
-2
votes
1answer
61 views

Scaffold design pattern [duplicate]

I'm looking for something that might be described as a "Scaffold design pattern". I'm in the process of resurrecting an old piece of working but very buggy code that implements a Finite ...
0
votes
2answers
44 views

Handling a column in a database which can change on external conditions

Let's suppose we have a table of products, similar to this one: ProductId ProductFriendlyName ProductPrice 84 Coke can 2 When a specific condition applies (the actual condition isn't really ...
1
vote
2answers
322 views

No trivial god-class refactoring

Consider you have the following code: class UserContainer { List<User> user; //some methods to get specific users, for example users, which are higher than 1,70meters } The User have a ...
0
votes
0answers
33 views

Am I doing Unit Of Work or Context Object pattern against my API, or none of em?

I have created a "simple" C# client library for an HTTP based API (So, think kind of REST.. but yet not.. but that aint important for this discussion anyways, but might be important for some ...
1
vote
0answers
30 views

Managing the output rate for a queue triggered service

I have a service which is triggered by messages from three queues (which are populated by different topics), and writes the processed results to another system (say DB service) synchronously. The ...
0
votes
2answers
74 views

Good design for a class with multiple methods to test but one public method

I've been trying to refactor some existing code which is in essence a giant nested procedural call inside what should otherwise be an object oriented architecture. The entry point to the relevant code ...
3
votes
2answers
105 views

Best approach for inter-process task queues

I have an application made up of multiple processes/workers/services which need to send messages to each other that represent units of "enqueued tasks" to be done. I am trying to find the ...
0
votes
1answer
51 views

Pipeline's outputted data mirroring pipeline's architecture

I'm building a pipeline that scrapes data on entities, to keep things generic, let's call them Widgets. Data on Widgets is currently unorganized and spread across various sources, including source ...
0
votes
2answers
98 views

Is my analogy of an Abstract Factory valid?

After working through several tutorials and reading various responses on this site, I believe the Abstract Factory pattern would work well for a current project. I am seeking the opinions of those ...
0
votes
1answer
94 views

What design pattern (if so) did I apply? How can I further improve it?

Suppose I have a program.c that needs element_123 to do some operations, and element_123 can be accessed by including agent.h /*program.c*/ #include "agent.h" uint32_t element_123 = 0; ...
1
vote
1answer
66 views

Does it make sense to have a facade centralizing events too?

From my understanding a facade is a class with the sole purpose of simplifying the use of a specific system/module behavior (its methods). It should not contain any relevant logic of the underlying ...
-1
votes
2answers
101 views

How to deal with classes with same purpose from different libraries?

I have a question regarding software design/architecture. Are there any best practices or design patterns regarding the usage of classes with the same purpose from different libraries? Let's imagine ...
1
vote
2answers
62 views

c# template method pattern design question

I'm currently in a situation where I have multiple derived class types(just one is shown in the example below) that need to apply some logic before and/or after calling a method implemented in a ...
4
votes
3answers
209 views

Passing object or using the field

I would like to know what is a more appropriate way to code in Java. Is it generally better to pass entire objects in the method's parameters or just using the fields from the class? Using the field: ...
0
votes
1answer
73 views

Should there only ever be one instance of a ViewModel object?

Assume a rather simplistic model: class Person{ static List<Person> LivingPersons String Name List<Person> Dependents } From this it can (hopefully) be seen that a single ...

1
2 3 4 5
82