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
0
votes
0answers
35 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 ...
-5
votes
0answers
33 views

Benefits of SPA Frameworks over Traditional Web Apps [closed]

Yes it has to be an opinion-based question, no harm in discussing the opinions in a Software Engineering exchange, Subject Software Engineering is purely based on an opinion-based recommendations, ...
3
votes
3answers
1k views

Am I using the factory method design pattern correctly, or which creational pattern should I use?

I've been studying creational design patterns for the past week or so because I have a common use case that keeps coming up, and I can't figure out which pattern fits the bill. Here is a simplified ...
1
vote
4answers
118 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 ...
0
votes
2answers
77 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 ...
-3
votes
0answers
49 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
votes
2answers
126 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
72 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
194 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
4answers
495 views

Managing multiple dynamic database connections

I'm working on a server, which you can pass some form of authentication as input (like connection string) and it will connect you to your database. So the DB connection is going to be dynamic. There ...
1
vote
2answers
80 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 ...
1
vote
4answers
856 views

What are “orthogonal” environment variables? [12-factor app]

I was reading the 12-factor app while thinking about the design of a personal project. I like a lot of what I read, but the following paragraph confused me: In a twelve-factor app, env vars are ...
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 ...
7
votes
3answers
3k views

How do you apply Single Responsibility principle to a repository

I am trying to apply "SOLID" whenever I can and try to use common sense and avoid a pattern when I see that a pattern is creating more problems than it's trying to solve. I don't want to apply a ...
5
votes
2answers
1k views

Balance between aggregate boundaries and domain consistency in DDD

Designing an Aggregate and choosing an Aggregate Root getting tricky for me all the time especially when it comes to ensuring right transactional contexts and consistency constraints so I'm wondering ...
0
votes
1answer
121 views

Could this be considered a valid State GoF Pattern implementation?

For teaching purpose, I would like to create a simple implementation of State Pattern using PHP 7.4. So, I've tried to create a simple "document state machine" starting with Draft, sending to review ...
0
votes
1answer
52 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" ...
18
votes
4answers
5k views

Should injecting dependencies be done in the ctor or per method?

Consider: public class CtorInjectionExample { public CtorInjectionExample(ISomeRepository SomeRepositoryIn, IOtherRepository OtherRepositoryIn) { this._someRepository = ...
1
vote
1answer
357 views

Organizing reducers in Redux

I will use the following popular todo list example for demonstration. Let's say I wanted to create a very basic todo list with this structure as the app state: { todos: { todoKey1: { ...
-2
votes
3answers
182 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 ...
0
votes
1answer
85 views

Pattern name to compare previous raw values to current values

I find myself applying a certain pattern again and again and I assume I am not the first one. I am looking for a name. In the environment I find myself in we get updates to values via an external ...
0
votes
3answers
143 views

How to implement a chain of events on a tree's CRUD operations?

I am working on a project in which I have a tree with 4 layers and the hierarchy is like this. Customer -> Site -> Location -> Guardroom In DB each entity has its own table and the child ...
-4
votes
1answer
64 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
27 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
65 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 ...
-1
votes
1answer
74 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 ...
0
votes
1answer
152 views

Static data reuse

I'm going to describe the situation first and ask questions in the end. I need to validate a scalar value using the Symfony Validator component. The value is an associative array. Now I have defined ...
-1
votes
0answers
68 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
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
3answers
92 views

Chain of responsibility look alike but choose handler at runtime

currently I have an structure of PopUps and I've been thinking to use Chain of Responsibility pattern, but the difference is a popup can back to previous one PopUp and also can go to any other PopUp. ...
-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
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
0answers
9 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 ...
0
votes
3answers
390 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-...
7
votes
4answers
2k views

Is it a good or a bad idea to use the Builder Pattern everywhere?

Recently I shared with my team the Builder Pattern(fluent style) for unit testing. I personally like to use that pattern for unit testing, since many objects are usually created and with different ...
5
votes
4answers
13k views

Designing a fitness / weight lifiting routine database

I'd like to create an app similar to Barbell Pro for Android, for practice / interest / educational purposes really. Or even as another example for database purposes, Fitocracy The problem is, I ...
0
votes
0answers
33 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 ...
2
votes
1answer
182 views

Dynamic Object Abilities When Saving State

I have n classes that extends from a State class, the purpose of the State class is to manage the state of the extended classes. For each class we need to save it in the database, remove it and select ...
1
vote
4answers
187 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 ...
11
votes
3answers
4k views

Should Entity Framework 6 not be used with repository pattern?

So I am asking this after reading the following: Why shouldn't I use the repository pattern with Entity Framework?. It seems there is a large split of people who say yay and those that say nay. ...
34
votes
9answers
9k views

How to determine if a class meets the single responsibility principle?

The Single Responsibility Principle is based on the high cohesion principle. The difference between the two is that a highly cohesive classes features a set of responsibilities that are strongly ...
0
votes
1answer
26 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 ...
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
104 views

How can I orchestrate multiple business tasks?

I have a WebApi backend with a Blazor WASM frontend. The application is split up into 3 main parts. Core, Infrastructure and Presentation. Basic onion architecture structure. Core.Domain Domain ...
-3
votes
0answers
52 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
0answers
37 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 ...
0
votes
4answers
235 views

A case when you can't make processing idempotent

I have just been confirmed for an interview and one of the hint questions given by the recruiter was: "Explain Idempotency and a case when you can't make processing idempotent" I understand ...
4
votes
1answer
148 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 ...

1
2 3 4 5
82