32,160 questions
3687
votes
40
answers
1.3m
views
What is dependency injection?
There have been several questions already posted with specific questions about dependency injection, such as when to use it and what frameworks are there for it. However,
What is dependency injection ...
2346
votes
40
answers
741k
views
What is Inversion of Control?
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?
2096
votes
41
answers
697k
views
Difference between static class and singleton pattern?
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-...
1487
votes
12
answers
334k
views
Naming Classes - How to avoid calling everything a "<WhatEver>Manager"? [closed]
A long time ago I have read an article (I believe a blog entry) which put me on the "right" track on naming objects: Be very very scrupulous about naming things in your program.
For example if my ...
920
votes
24
answers
1.0m
views
How do you implement the Singleton design pattern?
Recently I've bumped into a realization/implementation of the Singleton design pattern for C++. It has looked like this (I have adopted it from the real-life example):
// a lot of methods are omitted ...
845
votes
27
answers
413k
views
What is the difference between Builder Design pattern and Factory Design pattern? [closed]
What is the difference between the Builder design pattern and the Factory design pattern?
Which one is more advantageous and why ?
How do I represent my findings as a graph if I want to test and ...
672
votes
7
answers
570k
views
Examples of GoF Design Patterns in Java's core libraries
I am learning GoF Java Design Patterns and I want to see some real life examples of them. What are some good examples of these Design Patterns in Java's core libraries?
621
votes
11
answers
218k
views
What's an Aggregate Root?
I'm trying to get my head around how to properly use the repository pattern. The central concept of an Aggregate Root keeps coming up. When searching both the web and Stack Overflow for help with what ...
575
votes
31
answers
234k
views
Dependency Injection vs Factory Pattern [closed]
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 ...
571
votes
28
answers
52k
views
Commonly accepted best practices around code organization in JavaScript [closed]
As JavaScript frameworks like jQuery make client side web applications richer and more functional, I've started to notice one problem...
How in the world do you keep this organized?
Put all your ...
527
votes
19
answers
276k
views
What is the difference in case of intent and application between these two Patterns? [closed]
Factory and Abstract Factory are both creational patterns.
What is the difference in case of intent and application between these two Patterns?
517
votes
21
answers
258k
views
MVC pattern on Android
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?
490
votes
48
answers
403k
views
Simplest/cleanest way to implement a singleton in JavaScript
What is the simplest/cleanest way to implement the singleton pattern in JavaScript?
441
votes
17
answers
174k
views
Why is IoC / DI not common in Python?
In Java IoC / DI is a very common practice which is extensively used in web applications, nearly all available frameworks and Java EE. On the other hand, there are also lots of big Python web ...
379
votes
10
answers
144k
views
Singletons vs. Application Context in Android?
Recalling this post enumerating several problems of using singletons
and having seen several examples of Android applications using singleton pattern, I wonder if it's a good idea to use Singletons ...
368
votes
5
answers
118k
views
Design Patterns web based applications [closed]
I am designing a simple web-based application. I am new to this web-based domain.I needed your advice regarding the design patterns like how responsibility should be distributed among Servlets, ...
351
votes
22
answers
192k
views
How to study design patterns? [closed]
I have read around 4-5 books on design patterns, but still I don't feel I have come closer to intermediate level in design patterns?
How should I go studying design patterns?
Is there any good ...
349
votes
20
answers
130k
views
When should I use the Visitor Design Pattern? [closed]
I keep seeing references to the visitor pattern in blogs but I've got to admit, I just don't get it. I read the wikipedia article for the pattern and I understand its mechanics but I'm still confused ...
323
votes
24
answers
224k
views
Singleton: How should it be used
Edit:
From another question I provided an answer that has links to a lot of questions/answers about singletons: More info about singletons here:
So I have read the thread Singletons: good design ...
297
votes
6
answers
134k
views
Relational Database Design Patterns? [closed]
Design patterns are usually related to object oriented design.
Are there design patterns for creating and programming relational databases?
Many problems surely must have reusable solutions.
Examples ...
288
votes
12
answers
149k
views
Is there a Java equivalent or methodology for the typedef keyword in C++?
Coming from a C and C++ background, I found judicious use of typedef to be incredibly helpful. Do you know of a way to achieve similar functionality in Java, whether that be a Java mechanism, pattern,...
284
votes
16
answers
130k
views
What is an anti-pattern?
I am studying patterns and anti-patterns. I have a clear idea about patterns, but I don't get anti-patterns. Definitions from the web and Wikipedia confuse me a lot.
Can anybody explain to me in ...
279
votes
27
answers
84k
views
Is it bad practice to make a setter return "this"?
Is it a good or bad idea to make setters in java return "this"?
public Employee setName(String name){
this.name = name;
return this;
}
This pattern can be useful because then you can chain ...
253
votes
25
answers
134k
views
Handling Dialogs in WPF with MVVM
In the MVVM pattern for WPF, handling dialogs is one of the more complex operations. As your view model does not know anything about the view, dialog communication can be interesting. I can expose ...
245
votes
6
answers
187k
views
What is difference between MVC, MVP & MVVM design pattern in terms of coding c#
If we search Google using the phrase "differences between MVC, MVP & MVVM design pattern" then we may get a few URL's which discuss the difference between MVC MVP & MVVM design ...