Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Which design pattern do you think is the most popular?


locked by Yannis May 11 '13 at 22:16

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as not constructive by ChrisF Sep 1 '11 at 21:19

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

Both, if possible... – Tom Wijsman Sep 24 '10 at 14:56
"switch instead of polymorphism"? – mlvljr Nov 6 '10 at 19:55
@Bigown: You should then "accept" the answer you liked the most. If you don't like any of the answers, please offer a bounty. – Macneil Mar 3 '11 at 21:12
voted to close as not constructive - this is basically a poll. Unless someone has an empirical study to cite, the answers will all be guesses or favorites (or non-favorites) and the votes will reflect personal sentiments. The end result will be a list of design patterns with no depth. Hence, not constructive. – Steven A. Lowe Mar 3 '11 at 21:17
@Steven: I'm pretty sure Jay is right with The Big Ball of Mud. :-) – Tom Wijsman Mar 3 '11 at 22:53

16 Answers 16

up vote 39 down vote accepted

I'm pretty sure the most common is 'The Big Ball of Mud'. Unfortunately for us all.

Agree, when you start a new project everything is well structured and documented, but as the deadline approached, it all ends up like a big ball of mud – Arturo Molina Sep 24 '10 at 15:52
@Arturo - That's one possible reason. Others: 1) Small project started by inexperienced programmer that is unexpectedly successful, and then grows beyond it's original purpose. 2) The tendency of inexperienced programmers being assigned to maintenance, who then don't have guidance or understanding of the original architecture, so they just hack stuff in, and it gets worse as system ages. 3) The team uses the wrong technology, or a new technology they are unfamiliar with and use it poorly on a new project, and it craters before the deadline :) – Jay Sep 24 '10 at 16:06
LOL - if I could add more points to you, I would. Excellent (and sad) observation. – luis.espinal Feb 24 '11 at 15:18

MVC and its variations is definitely one of the top design patterns.

I was going to say that the OP's question is rather silly (I still believe it is). However, your answer is pretty much right IMO. If there is one pattern (and its variations) that is pretty much used consistently, it is this one. +1 for your good answer. – luis.espinal Feb 24 '11 at 15:15

If you're talking about Gang-of-Four design patterns I would have to say Singleton. This is a really sad state of affairs - almost as if programmers hear about the magic of design patterns and then simply stop after the first one.

If you're talking about architectural-style patterns (in other words, design patterns which span multiple classes or layers) I would have to say MVC. A few other popular ones are the repository pattern and service-locator.

It's even sadder when you consider many people consider the Singleton an antipattern! – RichardOD Sep 24 '10 at 15:28
@RichardOD, sad that people consider it one when it isn't, or sad that people use it when it's an anti-pattern? – Matt Olenik Sep 24 '10 at 16:57
What I mean is it is sad that is so popular- it seems to be an interview favourite. Last time I was interviewed I was asked how I would code a Singleton, and my response was that I wouldn't I'd use an IoC container like Unity to handle that for me. – RichardOD Sep 26 '10 at 14:19
@RichardOD - it's not singleton that it is considered an anti-pattern. It is the abuse usage of it that is an anti-pattern. Very few cases actually demand/need singleton, and in environments with containers that control resource granularity, they aren't even needed. When you see a singleton in a modern Java code base, for instance, that's a typically a red flag for an anti-pattern usage (not on the singleton pattern itself.) – luis.espinal Feb 24 '11 at 15:14
@Jaco - I would have a different take from you. I think composite, strategy and template (and their multiple reincarnations) have become far, far more prevalent than singleton, specially since we have been focusing on structural composition over inheritance for the last decade or so. – luis.espinal Feb 24 '11 at 15:17


If you've ever used an event. You've used Observer.

This must be the winner! – Fredrik Wallenius Mar 3 '11 at 21:25


Add functionality to an object at runtime through composition. My personal favorite.

Edit: Also Factory is probably one of the most common.



Think of any REST interface like Twitter or the SO APIs. It's hiding a bunch of back end stuff that, at least in twitters case, can be horribly complex.

Do I care which db tables @apklusk's tweets are stored in? And that it has a fast cache? And that @shemnon has such low readership the tweets are always out of memory? That's the magic of the Facade.


Strategy Pattern

If you've ever used dependency injection, you've used the strategy pattern.

Agreed, strategy in addition to template and composite (and their multiple variations and combination.) – luis.espinal Feb 24 '11 at 15:19

Why has nobody mentioned the iterator yet? Especially with all the maps that make up complex data structures... its the one I use the most. Or are we talking about patterns that we re-implement?


I am surprised no one has mentioned the Factory pattern, in my experience that is one of the most used (and also most abused) of the patterns out there. If not first, probably the singleton should be first, I would have thought this would be a close second.


Along with my previous answer, I'm going to add a new one I ran into today from my beast of an inherited project:


While debugging I ran into a piece of code calling 2 similarly named functions:


Func1 and Func2 had the same parameters. I pulled them out and diffed, and they are 100% the same except for Func1 calls Func3 and Func2 calls Func4. I pulled those out and diffed them. 100% the same, except for 1 line. So a previous programmer decided to copy and paste two 50-line-nested functions, instead of adding a flag parameter, to 2 private functions used in exactly 1 place. It makes me want to cry.


Talking about Gang-of-Four design patterns, I can't think of a program that does not use the Observer pattern. Also, as Jaco mentioned, Singleton is highly used too, unfortunately it has become a hammer (any programmer uses it even if it's not completely needed).

Funny, but I've never had the need to use a Singleton. If I need someplace to hold global state, I put it in a configuration file and use a normal class to access it. – Robert Harvey Sep 24 '10 at 15:01
Of course, in those cases it's not needed... what about when you really need one object to do some job, synchronously, and thread safe. Singleton is not just for holding the state of some static variables, it's a real object with real job to do, etc. – Cristian Sep 24 '10 at 15:31
Only time I've ever seen need for it is database connections. That said, nearly every "Service" (read: similar to factory) class in this project at work is a singleton, stored in the PHP $_SESSION variable. – Tarka Sep 24 '10 at 16:16


Rarely implemented, often used. XPATH, XSLT, Regex, jQuery selectors, etc.


I'm surprised no one has said "Builder" yet. Or "Adapter". They're probably not as exotic as some of the other ones mentioned, but I use them all the time. Factory and Abstract Factory are very common as well (but they're already taken).



I don't think it's listed in the GoF, but I use variations of it all the time.


The most frequently used design pattern is, obviously, Spaghetti.


At the software design level, I would argue that Composite, Strategy and Template (and to a lesser extend, Factory) are the most widely usage. For the last decade or so we have seen a preference for composition over inheritance when building our systems using a OO design. As a result, combination of the patterns just mentioned play a much more important role than all others IMO.

Architecturally, I'd argue for MVC on the enterprise, and patterns based on state machines on the embedded side of things.


protected by Walter Feb 2 '11 at 23:29

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.