Skip to main content

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
1 answer
487 views

I have a situation where I think it would be best to combine two architectures but I am not sure if this is possible or that it is a good thing to do. By combining them I mean taking certain parts of ...
Mbuso Kotobe's user avatar
1 vote
0 answers
124 views

I'm writing a virtual CPU, and I decided to create a class for each command, to make it easier to replace/add/remove commands without changing too much. The original idea was that ICommand would be ...
Bipolo's user avatar
  • 83
0 votes
2 answers
466 views

I have this use case (I've simplified it): Each student can apply for one or multiple activities. As of now we only have Swimming activity onboarded on the system, but we expect to have more. Base ...
Juanma's user avatar
  • 109
2 votes
2 answers
333 views

I am working on a problem with lots of if-then-else calculations. I am trying to compartmentalize the logic to make it more maintainable and less error prone. But, as I try options, I don't see what ...
eSurfsnake's user avatar
-2 votes
1 answer
225 views

This site mentions such thing: http://software-pattern.org/Reflection. It says that it is possible to replace part of the application behaviour dynamically. Does it mean that we can achieve partial ...
Mike's user avatar
  • 11
2 votes
2 answers
359 views

The Collection interface in Java has, among others, these methods: boolean add(E e) boolean addAll(Collection<? extends E> c) boolean remove(Object o) boolean removeAll(Collection<?> c) ...
holmis83's user avatar
  • 137
1 vote
3 answers
2k views

I have two tables, parent and child. Parents can "have" multiple children—in our case they are related through a third table, parent_child_mapping rather than the child storing its parent id ...
Andrew Cheong's user avatar
1 vote
2 answers
405 views

My team is communicating proposals for the interaction of several processes as a flowchart. I've been drafting a codebase architecture we can use as a starting point. There are two ways intended ...
J.G.'s user avatar
  • 335
0 votes
1 answer
74 views

I am trying something out in Springboot and stuck with a weird issue where I want to send some data from my frontend (react app) to backend (SpringBoot) and make that request non replay able by users (...
Abhijeet Shukla's user avatar
2 votes
2 answers
536 views

I am currently reading Clean Code by Robert C. Martin and in Chapter 8: Boundaries one can find this paragraph: We wanted to tell the transmitter something like this: Key the transmitter on the ...
SirHawrk's user avatar
  • 259
2 votes
2 answers
602 views

I'm developing an application (Java) in a modular architecture. I have two approaches in mind and I'm not sure which one will be "better code" in case of maintenance and conventions. I have ...
SmallDevice's user avatar
5 votes
2 answers
737 views

I've come onto a new a project and the permissions are done with an allow and a deny option for every permission. Until now i've only ever seen/build allow only permissions. What is the advantage of ...
DFENS's user avatar
  • 385
2 votes
3 answers
393 views

Context for this question I'm currently working with small data storage media (e.g. RFID tags) that contain some fixed number of bytes that can be manipulated. The drivers that allow reading bytes ...
JansthcirlU's user avatar
1 vote
1 answer
787 views

I stumbled on following problem, and I'm curious if it could be done better. A while ago I wrote a factory class that looked something like this: public class Foo { private IDbContext ...
Draeggiar's user avatar
5 votes
1 answer
213 views

I work for an engineering firm which builds most of our physics models in Excel with VBA. For myself and many other younger mechanical engineers in the company, this is not a good solution - we grew ...
Emily Conn's user avatar
0 votes
4 answers
674 views

I got a bit strange 'future ready' scenario. And I'm not sure if I got it right in regards to C# adapter design pattern. The scenario is that to be future ready, 'to use the adapter pattern' to easily ...
Peter's user avatar
  • 137
2 votes
4 answers
310 views

I've been coding in python for about 6 years now. I am proficient enough to understand a good amount of the language features. When I look into source code for a number of libraries such as pandas or ...
user32882's user avatar
  • 267
0 votes
3 answers
980 views

I use java and I have structure with a class that contains id, title and perhaps some children of the same class. So I decided to use the composite pattern. I need to have a method getChildren() that ...
Christoforos's user avatar
1 vote
1 answer
592 views

I am rather unclear about how an event gets processed when a state machine has orthogonal regions. I did read that With composite states, that an event should be sent to the innermost state, and if ...
Christopher Pisz's user avatar
-1 votes
1 answer
162 views

The task is, Given a list of files, for each file do some processing (sub-tasks) like encoding and encrypting. In the following implementation, I used Composition where MultiFileProcessor uses ...
Turtle's user avatar
  • 117
2 votes
1 answer
142 views

I'm reading a book on design patterns. On proxy pattern the code are following: class SensitiveInfo: def __init__(self): self.users = ['nick', 'tom', 'ben', 'mike'] def read(self): ...
Yehui He's user avatar
5 votes
3 answers
254 views

The Wikipedia article on the Composite Design Pattern includes the following diagram: As you see, there is an association relationship which is child 0..* – 1 parent (association). However, shouldn't ...
Aldan Creo's user avatar
0 votes
2 answers
650 views

I have a service class that does some magic. I want to introduce a new type of functionality - raise an event. I am absolutely sure that decorator pattern is great for this scenario. The problem is ...
pro100tom's user avatar
  • 449
1 vote
2 answers
576 views

I was reading about these patterns and noticed that they seem to be basically the same, but in different contexts? If that's the case, why isn't Front Controller just considered as a Mediator pattern ...
Oscar Calderon's user avatar
2 votes
2 answers
147 views

Lets say we have an Webserver-Framework and a Database-Framework, and now i want to configure that Webserver and the Database, then it could look like the following class Start { public static ...
Robin Kreuzer 2's user avatar

1
5 6
7
8 9
91