Skip to main content
Filter by
Sorted by
Tagged with
Best practices
0 votes
3 replies
65 views

I’m studying and implementing the Composite design pattern in C# for a university project. In most textbook examples (GoF, Refactoring.Guru, etc.) the class hierarchy looks like this: Component ├── ...
user31880897's user avatar
Best practices
0 votes
0 replies
44 views

I’m currently working on a personal Android project using Kotlin and Android Studio, following a basic MVVM architecture: ─main │ ├───java │ │ └───com │ │ └───example │ │ └───...
alex_pythooon's user avatar
0 votes
0 answers
80 views

I wanted to create a flexible MessageProcessor, depending on the SupplierType(= enum) and depending on which MessageProcessor comes out a different Message-object will be used. The current situation ...
zhrgci's user avatar
  • 716
1 vote
0 answers
67 views

TL;DR Suppose a Python library defines an interface meant to be implemented by third-party code. How could this library provide a factory function that creates instances of those implementations, with ...
mgab's user avatar
  • 4,054
Advice
0 votes
0 replies
25 views

Question: I'm building a testing system for a data quality SaaS app where tests are entirely props-driven (similar to React component testing philosophy). Goal: Create reusable, composable test ...
Vijay Savaliya's user avatar
Best practices
3 votes
1 replies
107 views

I am creating an E-Commerce app. It has Category and Product classes. Both have multilingual descriptions, so, tables with title, description, meta-*, etc. and unique key (id, language_id). To add ...
qarabala's user avatar
  • 178
2346 votes
40 answers
741k views

Inversion of Control (IoC) can be quite confusing when it is first encountered. What is it? Which problem does it solve? When is it appropriate to use and when not?
Mike Minutillo's user avatar
2096 votes
41 answers
697k views

What real (i.e. practical) difference exists between a static class and a singleton pattern? Both can be invoked without instantiation, both provide only one "Instance" and neither of them is thread-...
Jorge Córdoba's user avatar
2387 votes
24 answers
584k views

When looking beyond the RAD (drag-drop and configure) way of building user interfaces that many tools encourage you are likely to come across three design patterns called Model-View-Controller, Model-...
Mike Minutillo's user avatar
1492 votes
26 answers
724k views

Is there a difference between the standard "Model View Controller" pattern and Microsoft's Model/View/ViewModel pattern?
Bjorn Reppen's user avatar
  • 22.8k
1152 votes
30 answers
131k views

Since I started learning F# and OCaml last year, I've read a huge number of articles which insist that design patterns (especially in Java) are workarounds for the missing features in imperative ...
Juliet's user avatar
  • 81.7k
490 votes
48 answers
403k views

What is the simplest/cleanest way to implement the singleton pattern in JavaScript?
Jakub Arnold's user avatar
  • 87.5k
5 votes
2 answers
198 views

Let me introduce first the problem. I will present a simplification of my QT6 project app (in C++) to not make it too difficult to read, as the original code has lots of unnecesary things for this ...
Alberto Moreno Castro's user avatar
858 votes
29 answers
345k views

What is an efficient way to implement a singleton design pattern in Java?
Riyaz Mohammed Ibrahim's user avatar
575 votes
31 answers
234k views

Most of the examples quoted for usage of Dependency Injection, we can solve using the factory pattern as well. Looks like when it comes to usage/design the difference between dependency injection and ...
559 votes
21 answers
517k views

There seem to be many ways to define singletons in Python. Is there a consensus opinion on Stack Overflow?
Jamie's user avatar
  • 8,005
0 votes
0 answers
45 views

Goal Implement a Singleton Design Pattern for a struct, without multiprocessing considerations. Minimal example Here is the base of the code, without the singleton logic. struct ...
GregoirePelegrin's user avatar
574 votes
24 answers
338k views

The glorified global variable - becomes a gloried global class. Some say breaking object-oriented design. Give me scenarios, other than the good old logger where it makes sense to use the singleton.
Setori's user avatar
  • 10.6k
2 votes
0 answers
213 views

I'm designing my system which consists of three parts, abstract layer (al) where traits and generic data structures are defined; implementation layer (il) where different structures implement traits; ...
Eason's user avatar
  • 171
527 votes
19 answers
276k views

Factory and Abstract Factory are both creational patterns. What is the difference in case of intent and application between these two Patterns?
user366312's user avatar
  • 17.5k
618 votes
13 answers
308k views

What are some common, real world examples of using the Builder Pattern? What does it buy you? Why not just use a Factory Pattern?
Charles Graham's user avatar
168 votes
34 answers
389k views

I need to create a function which can be executed only once, in each time after the first it won't be executed. I know from C++ and Java about static variables that can do the work but I would like to ...
vlio20's user avatar
  • 9,335
6 votes
2 answers
152 views

I’m currently building a unit converter app in Java (as a beginner), and I want to avoid duplicating logic for each type of unit. Right now, I have different enums like Length, Weight, Time, etc., and ...
jamesdiaz's user avatar
  • 137
1 vote
1 answer
151 views

I have a templated class Bounded which have parameters: fundamental type Min value allowed Max value allowed policy (wrap, limit) I can do it if the struct defining policy is defined outside the ...
Tomáš Nadrchal's user avatar
517 votes
21 answers
258k views

Is it possible to implement the model–view–controller pattern in Java for Android? Or is it already implemented through Activities? Or is there a better way to implement the MVC pattern for Android?
Mohit Deshpande's user avatar

1
2 3 4 5
643