32,160 questions
102
votes
6
answers
54k
views
ASP.NET MVC - Should business logic exist in controllers?
Derik Whitaker posted an article a couple of days ago that hit a point that I've been curious about for some time: should business logic exist in controllers?
So far all the ASP.NET MVC demos I've ...
101
votes
14
answers
21k
views
Why all the Active Record hate? [closed]
As I learn more and more about OOP, and start to implement various design patterns, I keep coming back to cases where people are hating on Active Record.
Often, people say that it doesn't scale well (...
100
votes
14
answers
52k
views
Architecture of a single-page JavaScript web application?
How should a complex single-page JS web application be structured on the client-side? Specifically I'm curious about how to cleanly structure the application in terms of its model objects, UI ...
99
votes
20
answers
74k
views
Why do we need immutable class?
I am unable to get what are the scenarios where we need an immutable class.
Have you ever faced any such requirement? or can you please give us any real example where we should use this pattern.
98
votes
4
answers
65k
views
Design Principles, Best Practices and Design Patterns for C (or Procedural Programming in general)? [closed]
Are there any known design principles, best-practices and design patterns that one can follow while designing a C project? Or useful design principles for procedural (imperative) programming in ...
97
votes
3
answers
145k
views
Javascript: best Singleton pattern [duplicate]
Possible Duplicate:
Simplest/Cleanest way to implement singleton in JavaScript?
I'm using this pattern for singletons, in the example the singleton is PlanetEarth:
var NAMESPACE = function () {
...
96
votes
9
answers
28k
views
Façade vs. Mediator
I've been researching the difference between these two patterns.
I understand that facade encapsulates access to a sub system and mediator encapsulates the interactions between components.
I ...
95
votes
2
answers
53k
views
What's the difference between Red/Black deployment and Blue/Green Deployment?
I've heard both used to describe the idea of deploying an update on new machines while keeping old machines active, ready to rollback if an issue occurs. I've also heard it used to describe sharing ...
93
votes
3
answers
145k
views
What does a diamond sign signify in UML class diagrams?
Consider the below two diagrams. The top one contains a plain arrow at the right end, and the bottom one contains an arrow with a diamond at the left end and a plain arrow at the right end. The great ...
93
votes
15
answers
16k
views
Why should I isolate my domain entities from my presentation layer?
One part of domain-driven design that there doesn't seem to be a lot of detail on, is how and why you should isolate your domain model from your interface. I'm trying to convince my colleagues that ...
92
votes
6
answers
119k
views
Angular design pattern: MVC, MVVM or MV*?
Angular 1.x (AngularJS) was following more or less the MV* design principle because of its two-way data binding functionality.
Angular2 is adopting a component-based UI, a concept that might be ...
92
votes
0
answers
125k
views
Python and the Singleton Pattern [duplicate]
What is the best way to implement the singleton pattern in Python? It seems impossible to declare the constructor private or protected as is normally done with the Singleton pattern...
91
votes
5
answers
54k
views
Which design patterns can be applied to the configuration settings problem?
In large and complex software products managing configurable settings becomes a major pain. Two approaches I've seen to the problem are:
have each component in the system load its own configuration ...
90
votes
8
answers
115k
views
What is the solution for the N+1 issue in JPA and Hibernate?
I understand that the N+1 problem is where one query is executed to fetch N records and N queries to fetch some relational records.
But how can it be avoided in Hibernate?
90
votes
6
answers
25k
views
Synchronizing client-server databases
I'm looking for some general strategies for synchronizing data on a central server with client applications that are not always online.
In my particular case, I have an android phone application with ...
89
votes
14
answers
65k
views
When to use the CQRS design pattern?
My team and I have been discussing using the CQRS (Command Query Responsibility Segregation) design pattern and we are still trying to asses the pros and cons of using it. According to: http://...
88
votes
17
answers
18k
views
Anemic Domain Model: Pros/Cons
I would like to know what the pros and cons are for using an Anemic Domain Model (see link below).
Fowler Article
88
votes
22
answers
54k
views
When should you use the singleton pattern instead of a static class? [closed]
Name the design considerations in deciding between use of a singleton versus a static class. In doing this, you're kind of forced to contrast the two, so whatever contrasts you can come up with are ...
87
votes
7
answers
66k
views
When should I choose inheritance over an interface when designing C# class libraries? [closed]
I have a number Processor classes that will do two very different things, but are called from common code (an "inversion of control" situation).
I'm wondering what design considerations I should be ...
87
votes
4
answers
80k
views
Differentiating between domain, model, and entity with respect to MVC
Can someone explain these 3 concepts and the differences between them with respect to an MVC framework along with an example. To me these appear almost equivalent, and it seems they are used ...
87
votes
4
answers
28k
views
Where does the "business logic layer" fit in to an MVC application?
First, before anyone screams dupe, I had a hard time summarizing it in a simple title. Another title might have been "What is the difference between a domain model and MVC model?" or "What is a model?...
86
votes
12
answers
63k
views
Difference between Observer Pattern and Event-Driven Approach
I always found the Observer Pattern almost similar to the usual event-driven approach. Actually, I have almost believed that they are actually just different names referring to the same thing. They ...
86
votes
5
answers
130k
views
What are the DAO, DTO and Service layers in Spring Framework?
I am writing RESTful services using spring and hibernate. I read many resource in internet, but they did not clarify my doubts. Please explain me in details what are DAO, DTO and Service layers in ...
84
votes
4
answers
47k
views
Authorization approaches and design patterns for Node.js applications [closed]
I am building a multiple page admin interface for an internal enterprise software platform. Think lots of glue logic tying together various APIs, db queries, and shell scripts.
We will be using node....
83
votes
6
answers
115k
views
Instantiate an object with a runtime-determined type
I'm in a situation where I'd like to instantiate an object of a type that will be determined at runtime. I also need to perform an explicit cast to that type.
Something like this:
static void ...