A design pattern is a general reusable solution to a commonly occurring problem in software design.
25
votes
4answers
1k views
When is Singleton appropriate?
Some hold that the Singleton Pattern is always an anti-pattern. What do you think?
12
votes
11answers
1k views
Is there a canonical book on design patterns?
I am interested in learning design patterns and would like to know what are considered top tier books in learning this subject.
Is there a book out there that's the de-facto standard for describing ...
50
votes
10answers
2k views
Non-OOP Design Patterns?
I have only heard the term "design pattern" being used for object oriented code, and the GoF patterns include only OOP design patterns, but design patterns are elegant solutions for commonly occuring ...
36
votes
2answers
2k views
Are there any OO-principles that are practically applicable for Javascript?
Javascript is a prototype-based object oriented language but can become class-based in a variety of ways, either by:
Writing the functions to be used as classes by yourself
Use a nifty class system ...
62
votes
16answers
5k views
Why is Global State so Evil?
Before we start this, let me say I'm well aware of the concepts of Abstraction and Dependency Injection. I don't need my eyes opened here.
Well, most of us say, (too) many times without really ...
57
votes
13answers
12k views
Do I need to use an interface when only one class will ever implement it?
Isn't the whole point of an interface to for multiple classes to adhere to a set of rules and implementations?
24
votes
6answers
3k views
How essential is it to make a service layer?
I started building an app in 3 layers (DAL, BL, UI) [it mainly handles CRM, some sales reports and inventory].
A colleague told me that I must move to service layer pattern, that developers came to ...
7
votes
3answers
3k views
What is the difference between all-static-methods and applying a singleton pattern?
I am making a database to store information about the users of my website (I am using stuts2 and hence Java EE technology). For the database I'll be making a DBManager. Should I apply singleton ...
85
votes
16answers
5k views
“Never do in code what you can get the SQL server to do well for you” - Is this a recipe for a bad design?
It's an idea I've heard repeated in a handful of places. Some more or less acknowledging that once trying to solve a problem purely in SQL exceeds a certain level of complexity you should indeed be ...
25
votes
8answers
8k views
Is ORM an Anti-Pattern? [closed]
I had a very stimulating and interessting discussion with a colleague about ORM and its pros and cons. In my opinion, an ORM is useful only in the rarest cases. At least in my experience.
But I don't ...
20
votes
7answers
1k views
The Singleton Pattern [duplicate]
Possible Duplicate:
When is Singleton appropriate?
I am a new programmer (4 months into my first job) and have recently taken an interest in design patterns. One that I have used recently ...
19
votes
10answers
2k views
To design pattern, or not to design pattern
Design patterns are good, but complex. Should we use them in small projects? Implementing design patterns needs more sophisticated developers, which in turn raises project costs. On the other hand, ...
10
votes
7answers
1k views
What can go wrong if the Liskov substitution principle is violated?
I was following this highly voted question on possible violation of Liskov Substitution principle. I know what the Liskov Substitution principle is, but what is still not clear in my mind is what ...
26
votes
1answer
2k views
What is the difference between the factory pattern and abstract factory?
Having finally begun seriously trying to learn some basic patterns (very late in the career, but that's a different story), I'm trying to get my head around the differences between the Factory Pattern ...
11
votes
0answers
1k views
What are good resources for Design Patterns? [duplicate]
Possible Duplicate:
Is there a canonical book on design patterns?
Design patterns are really useful when designing software.
What essential sites/books/blogs are good for ...
63
votes
10answers
15k views
What is MVC, really?
As a serious programmer, how do you answer the question What is MVC?
In my mind, MVC is sort of a nebulous topic — and because of that, if your audience is a learner, then you're free to ...
65
votes
20answers
4k views
Is OOP hard because it is not natural?
One can often hear that OOP naturally corresponds to the way people think about the world. But I would strongly disagree with this statement: We (or at least I) conceptualize the world in terms of ...
35
votes
15answers
6k views
When should I use—and not use—design patterns? [duplicate]
In a previous question of mine on Stack Overflow, FredOverflow mentioned in the comments:
Note that patterns do not magically improve the quality of your code.
and
Any measure of quality ...
29
votes
7answers
1k views
Design Patterns for Javascript [duplicate]
A lot of web frameworks have a MVC-style layout to code and approaching problems. What are some good similar paradigms for JavaScript? I'm already using a framework (jQuery) and unobtrusive js, but ...
14
votes
3answers
386 views
Learning about design
How do you improve your ability to design your applications? Where do you get your design ideas from? (I am asking about code design - not about a specific language and not about visual appeal).
When ...
14
votes
2answers
2k views
Alternative patterns for web development? (non-MVC)
Recently I've been reading some blog posts regarding MVC and how it doesn't fit the web. I've learned about alternative patterns like the RMR Architecture.
I'm curious what other patterns people are ...
22
votes
7answers
2k views
Return magic value, throw exception or return false on failure?
I sometimes end up having to write a method or property for a class library for which it is not exceptional to have no real answer, but a failure. Something cannot be determined, is not available, not ...
5
votes
6answers
523 views
What are the practical ways to implement the SRP?
Simply what are the practical techniques people use to check if a class violates the single responsibility principle?
I know that a class should have only one reason to change, but that sentence is ...
22
votes
4answers
2k views
Why was dependency injection pattern not included in the Gang of four?
Why was the dependency injection pattern not incluided in the gang of four? Did GOF pre-date widespread automated testing? Is dependency injection now considered a core pattern?
6
votes
2answers
841 views
Understanding the bridge design pattern
I do not understand the "bridge" design pattern at all. I have gone through various web sites, but they haven't helped.
Can anybody help me in understanding this?
6
votes
4answers
760 views
How does thinking on design patterns and OOP practices change in dynamic and weakly-typed languages?
There is a fairly helpful question already along these lines ("Non-OOP Design Patterns?"), but I am more curious about a transitional point of view for someone just getting started with dynamic and ...
5
votes
3answers
322 views
How to create a manager class without global variables nor singletons?
I would like to implement some kind of manager class in my application. It will be in charge of loading textures, processing them, distributing them etc...
At first, I wanted to make a global ...
5
votes
3answers
369 views
Avoid having an initialization method
I have this existing code where they have a class and an initialization method in that class. It is expected that once the object of the class is created, they need to call initialize on it.
Reason ...
6
votes
7answers
775 views
Can the Strategy pattern be implemented without significant branching?
The Strategy pattern works well to avoid huge if...else constructs and make it easier to add or replace functionality. However, it still leaves one flaw in my opinion. It seems like in every ...
3
votes
2answers
199 views
Should I extract specific functionality into a function and why?
I have a large method which does 3 tasks, each of them can be extracted into a separate function. If I'll make an additional functions for each of that tasks, will it make my code better or worse and ...
0
votes
3answers
2k views
Relationship DAO, Servlet, JSP and POJO
I want to implement a JSP, POJO, DAO and Servlet in my J2EE program. However, I don't fully understand how the relationship between these elements should be. Is the following (MVC) setup the right way ...
0
votes
1answer
437 views
A sample Memento pattern: Is it correct?
Following this query on memento pattern, I have tried to put my understanding to test.
Memento pattern stands for three things:
Saving state of the "memento" object for its successful ...
50
votes
8answers
8k views
Are there any design patterns that are unnecessary in dynamic languages like Python?
I've started reading the design pattern book by the GoF. Some patterns seem very similar with only minor conceptual differences.
Do you think out of the many patterns some are unnecessary in a ...
32
votes
9answers
5k views
So Singletons are bad, then what?
There has been a lot of discussion lately about the problems with using (and overusing) Singletons. I've been one of those people earlier in my career too. I can see what the problem is now, and yet, ...
13
votes
7answers
9k views
Web Developer interview questions
I read an article today that listed some basic questions about web development:
Describe how POST data was submitted to a server by a browser.
Explain a number of HTTP status codes (except maybe 404 ...
12
votes
2answers
3k views
Best practice/Patterns for two way data synchronisation
Quite often in my work the idea of 2-way data synchronisation between database systems crops up. The classic example is two slightly different CRM systems (say, Raiser's Edge and Salesforce) and the ...
28
votes
5answers
2k views
When is it not appropriate to use the dependency injection pattern?
Since learning (and loving) automated testing I have found myself using the dependency injection pattern in almost every project. Is it always appropriate to use this pattern when working with ...
18
votes
17answers
2k views
What would be a good name of practices you don't (usually) learn at university? [closed]
I'm preparing a course dedicated to fresh graduated CS students. I have to name it.
Is there an English word or sentence to define all the practices you don't learn at college/university?
Here are a ...
21
votes
5answers
1k views
How do I convince my boss (and other devs) to use/consider Unobtrusive JavaScript
I'm pretty new in our develepors team.
I need some strong arguments and/or "pitfall" examples, so my boss will finally understand the advantages of Unobtrusive JavaScript, so that he, and the rest of ...
16
votes
10answers
1k views
GoF Design Patterns - which ones do you actually use? [closed]
I'm trying to educate my colleagues in the area of design patterns. Some of the original Gang of Four patterns are a little esoteric, so I'm wondering if there is a sub-group of "essential" patterns ...
14
votes
7answers
2k views
What are the benefits of using Dependency Injection and IoC Containers?
I'm planning to do a talk on Dependency Injection and IoC Containers, and I'm looking for some good arguments for using it.
What are the most important benefits of using this technique, and these ...
11
votes
3answers
3k views
How do I set up MVP for a Winforms solution?
Question moved from Stackoverflow - http://stackoverflow.com/questions/4971048/how-do-i-set-up-mvp-for-a-winforms-solution
I have used MVP and MVC in the past, and I prefer MVP as it controls the ...
8
votes
1answer
310 views
When is a glue or management class doing too much?
I'm prone to building centralized classes that manage the other classes in my designs. It doesn't store everything itself, but most data requests would go to the "manager" first. While looking at an ...
4
votes
8answers
932 views
What do you consider to be the essential design patterns? And do you use them? [closed]
It seems to me that programmers have an increasingly uphill task of staying up-to-date.
In my efforts to improve my programming ability, I am in search of the essential design patterns that are ...
17
votes
12answers
2k views
What should a programmer learn first: Algorithms or Design Patterns?
I have new junior programmers (new graduates) who just joined my team, some of them do not know much about algorithms and design patterns. I am not sure which one should I teach them first?
17
votes
6answers
2k views
How much business logic should be allowed to exist in the controller layer?
Sometimes we have some business logic represented in the controller code of our applications. This is usually logic that differentiates what methods to call from the model and/or what arguments to ...
12
votes
4answers
752 views
How to determine whether Design Pattern is implemented correctly?
I am successfully able to scale all my old applications which were not using documented Design Patterns. Whatever pattern it is I don't know. To a large extent, I only felt a need to use simple OOP ...
8
votes
4answers
429 views
In MVC, can/should basic data retrieval from the Model be done in the View?
Given the concept of 'skinny controllers, fat models' and the general acceptance that Views can directly call on Models when requiring data for output, should one consider handling the 'get and ...
8
votes
2answers
256 views
where can I find an overview of known “multithreading systems architectures” design patterns?
Using C#, I have been doing multithreaded development for about 5 years, and consider myself quite proficient (I wrote my own lock-free queue and task parallel framework before Microsoft made TPF).
...
7
votes
6answers
908 views
Why is subclassing too much bad (and hence why should we use prototypes to do away with it)?
I was reading up on design patterns, and I read that the prototype design pattern does away with excessive subclassing.
Why is subclassing bad? What advantage would using a prototype bring about over ...

