<p>What's the penetration of design patterns in the real world? Do you use them in your day to day job - discussing how and where to apply them with your coworkers - or do they remain more of an academic concept? </p>

<p>Do they actually provide actual value to your job? Or are they just something that people talk about to sound smart?</p>

<p>Note: For the purpose of this question ignore 'simple' design patterns like <em>Singleton</em>. I'm talking about designing your code so you can take advantage of <em>Model View Controller</em>, etc.</p>

[{'answer_id': 11587, 'author': 'Thomas Owens', 'author_id': 572, 'author_profile': 'https://Stackoverflow.com/users/572', 'pm_score': 2, 'selected': False, 'text': "<p>I try to, yes. They do indeed help maintainability and readability of your code. However, there are people who do abuse them, usually (from what I've seen) by forcing a system into a pattern that doesn't exist.</p>\n"}, {'answer_id': 11589, 'author': 'Tanerax', 'author_id': 567, 'author_profile': 'https://Stackoverflow.com/users/567', 'pm_score': 2, 'selected': False, 'text': '<p>There are many design patterns beyond the simple that are used in "real world". Good example Stackoverflow uses the Model View Controller Pattern. I have used Class Factories multiple times in projects for my employer, and I have seen many already written projects using them as well. </p>\n\n<p>I am not saying every design pattern is being used but many are.</p>\n'}, {'answer_id': 11591, 'author': 'mbillard', 'author_id': 810, 'author_profile': 'https://Stackoverflow.com/users/810', 'pm_score': 2, 'selected': False, 'text': "<p>Yes we do, it usually happens when we start designing something and then someone notices that it resembles an existing pattern. We then take a look at it and see how it would help us achieve our goal.</p>\n\n<p>We also use patterns that are not documented but that emerge from designing a lot.</p>\n\n<p>Mind you, we don't use them a lot.</p>\n"}, {'answer_id': 11592, 'author': 'Greg Hurlman', 'author_id': 35, 'author_profile': 'https://Stackoverflow.com/users/35', 'pm_score': 2, 'selected': False, 'text': '<p>Yes, Factory, Chain of Responsibility, Command, Proxy, Visitor, and Observer, among others, are in use in a codebase I work with daily.  As far as MVC goes, this site seems to use it quite well, and the devs couldn\'t say enough good things in the <a href="http://itc.conversationsnetwork.org/shows/detail3787.html" rel="nofollow noreferrer">latest podcast</a>.</p>\n'}, {'answer_id': 11597, 'author': 'Patrik Svensson', 'author_id': 936, 'author_profile': 'https://Stackoverflow.com/users/936', 'pm_score': 2, 'selected': False, 'text': "<p>I try to use patterns if they are applicable. I think it's kind of sad seeing developers implement design patterns in code just for the sake of it. For the right task though, design patterns can be very useful and powerful.</p>\n"}, {'answer_id': 11601, 'author': 'Brad Barker', 'author_id': 12081, 'author_profile': 'https://Stackoverflow.com/users/12081', 'pm_score': 1, 'selected': False, 'text': "<p>Yes, I use a lot of well known design patterns, but I also end up building some software that I later find out uses a 'named' design pattern. Most elegant, reusable designs could be called a 'pattern'. It's a lot like dance moves. We all know the waltz, and the 2-step, but not everyone has a name for the 'bump and scoot' although most of us do it.</p>\n"}, {'answer_id': 11602, 'author': 'Dan Blair', 'author_id': 1327, 'author_profile': 'https://Stackoverflow.com/users/1327', 'pm_score': 1, 'selected': False, 'text': "<p>MVC is very well known so yes we use design patterns quite a lot.  Now if your asking about the Gang of Four patterns, there are several that I use because other maintainers will know the design and what we are working towards in the code.  There are several though that remain fairly obscure for what we do, so if I use one I don't get the full benefits of using a pattern.</p>\n\n<p>Are they important, yes because it gives you a method of talking about software design in a quick efficient and generally accepted way.  Can you do better custom solutions, well yes (sorta)?</p>\n\n<p>The original GoF patterns were pulled from production code, so they catalogued what was already being used in the wild.  They aren't purely or even mostly an academic thing.</p>\n"}, {'answer_id': 11609, 'author': 'Louis Salin', 'author_id': 160, 'author_profile': 'https://Stackoverflow.com/users/160', 'pm_score': 1, 'selected': False, 'text': '<p>I find the MVC pattern really useful to isolate your model logic, which can than be reused or worked on without too much trouble. It also helps de-coupling your classes and makes unit testing easier. I wrote about it <a href="http://blog.lonestardeveloper.com/2008/07/mvc-pattern-and-me.html" rel="nofollow noreferrer">recently</a> (yes, shameless plug here...)</p>\n\n<p>Also, I\'ve recently used a factory pattern from a base class to generate and return the proper DataContext class that I needed on the fly, using <a href="http://msdn.microsoft.com/en-us/netframework/aa904594.aspx" rel="nofollow noreferrer">LINQ</a>.</p>\n\n<p>Bridges are used when trying when trying to glue together two different technologies (like <a href="http://rubycocoa.sourceforge.net/HomePage" rel="nofollow noreferrer">Cocoa and Ruby</a> on the Mac, for example)</p>\n\n<p>I find, however, that whenever I implement a pattern, it\'s because I knew about it before hand. Some extra thought generally goes into it as I find I must modify the original pattern slightly to accommodate my needs.</p>\n\n<p>You just need to be careful not to become and <a href="http://www.joelonsoftware.com/articles/fog0000000018.html" rel="nofollow noreferrer">architecture astronaut</a>! </p>\n'}, {'answer_id': 11617, 'author': 'Derek Park', 'author_id': 872, 'author_profile': 'https://Stackoverflow.com/users/872', 'pm_score': 7, 'selected': True, 'text': "<p>Any large program that is well written will use design patterns, even if they aren't named or recognized as such.  That's what design patterns are, designs that repeatedly and <em>naturally</em> occur.  If you're interfacing with an ugly API, you'll likely find yourself implementing a <code>Facade</code> to clean it up.  If you've got messaging between components that you need to decouple, you may find yourself using <code>Observer</code>.  If you've got several interchangeable algorithms, you might end up using <code>Strategy</code>.</p>\n\n<p>It's worth knowing the design patterns because you're more likely to recognize them and then converge on a clean solution more quickly.  However, even if you don't know them at all, you'll end up creating them eventually (if you are a decent programmer).</p>\n\n<p>And of course, if you are using a modern language, you'll probably be forced to use them for some things, because they're baked into the standard libraries.</p>\n"}, {'answer_id': 11657, 'author': 'Coincoin', 'author_id': 42, 'author_profile': 'https://Stackoverflow.com/users/42', 'pm_score': 3, 'selected': False, 'text': '<p>In my opinion, the question: "Do you <strong>use</strong> design pattern?", alone is a little flawed because the answer is universally YES.</p>\n\n<p>Let me explain, we, programmers and designers, all use design patterns... we just don\'t always realise it. I know this sounds cliché, but you don\'t go to patterns, patterns come to you. You design stuff, it might look like an existing pattern, you name it that way so everyone understand what you are talking about and the rationale behind your design decision is stronger, knowing it has been discussed <em>ad nauseum</em> before.</p>\n\n<p>I personally use patterns as a communication tool. That\'s it. They are not design solutions, they are not best practices, they are not tools in a toolbox.</p>\n\n<p>Don\'t get me wrong, if you are a beginner, books on patterns will show you how a solution is best solved "using" their patterns rather than another flawed design. You will probably learn from the exercise. However, you have to realise that this doesn\'t mean that every situation needs a corresponding pattern to solve it. Every situation has a quirk here and there that will require you to think about alternatives and take a difficult decision with no perfect answer. <strong>That\'s</strong> design.</p>\n\n<p>Anti-pattern however are on a totally different class. You actually <strong>want</strong> to <strong>actively</strong> avoid anti-patterns. That\'s why the name anti-pattern is so controversial.</p>\n\n<p>To get back to your original question:<br>\n"Do I use design patterns?", Yes!<br>\n"Do I actively lean toward design patterns?", No.  </p>\n'}, {'answer_id': 11726, 'author': 'Barrett Conrad', 'author_id': 1227, 'author_profile': 'https://Stackoverflow.com/users/1227', 'pm_score': 0, 'selected': False, 'text': '<p>I absolutely use design patterns.  At this point I take MVC for granted as a design pattern.  My primary reason for using them is that I am humble enough to know that I am likely not the first person to encounter a particular problem.  I rarely start a piece of code knowing which pattern I am going to use; I constantly watch the code to see if it naturally develops into an existing pattern.  </p>\n\n<p>I am also very fond of <a href="http://martinfowler.com/" rel="nofollow noreferrer">Martin Fowler\'s</a> <a href="https://rads.stackoverflow.com/amzn/click/com/0321127420" rel="nofollow noreferrer" rel="nofollow noreferrer">Patterns of Enterprise Application Architecture</a>.  When a problem or task presents itself, I flip to related section (it\'s mostly a reference book) and read a few overviews of the patterns. Once I have a better idea of the general problem and the existing solutions, I begin to see the long term path my code will likely take via the experience of others. I end up making much better decisions.</p>\n\n<p>Design patterns definitely play a big role in all of my "for the future" ideas. </p>\n'}, {'answer_id': 30718, 'author': 'Vinnie', 'author_id': 2890, 'author_profile': 'https://Stackoverflow.com/users/2890', 'pm_score': 1, 'selected': False, 'text': '<p>Yes, design patterns are largely used in the real world - and daily by many of the people I work with.</p>\n\n<p>In my opinion the biggest value provided by design patterns is that they provide a universal, high level language for you to convey software design to other programmers.  </p>\n\n<p>For instance instead of describing your new class as a "utility that creates one of several other classes based on some combination of input criteria", you can simply say it\'s an <em>"abstract factory"</em> and everyone instantly understands what you\'re talking about. </p>\n'}, {'answer_id': 2261306, 'author': 'Justin Ethier', 'author_id': 101258, 'author_profile': 'https://Stackoverflow.com/users/101258', 'pm_score': 2, 'selected': False, 'text': '<p>Yes. Design patterns can be wonderful when used appropriately. As you mentioned, I am now using Model-View-Controller (MVC) for all of my web projects. It is a very common pattern in the web space which makes server-side code much cleaner and well-organized. </p>\n\n<p>Beyond that, here are some other patterns that may be useful:</p>\n\n<ul>\n<li><p>MVVM (Model-View-ViewModel): a similar pattern to MVC; used for WPF and Silverlight applications.</p></li>\n<li><p>Composition: Great for when you need to use a hierarchy of objects.</p></li>\n<li><p>Singleton: More elegant than using globals for storing items that truly need a single instance. As you  mentioned, a simple pattern but it does have its uses.</p></li>\n</ul>\n\n<p>It is worth noting a design pattern can also highlight a lack of language features and/or deficiencies in a language. For example, iterators are now built in as part of newer languages. </p>\n\n<p>In general design patterns are quite useful but you should not use them everywhere; just where they are a good fit for your needs.</p>\n'}, {'answer_id': 2544884, 'author': 'baris.aydinoz', 'author_id': 305038, 'author_profile': 'https://Stackoverflow.com/users/305038', 'pm_score': 1, 'selected': False, 'text': '<p>Yes, design patterns or abstractly patterns are part of my life, where I look, I begin to see them. Therefore, I am surrounded by them. But, as you know, little knowledge is a dangerous thing. Therefore, I strongly recommend you to read GoF book. </p>\n\n<p>One of the main problems about design patterns, most developers just do not get the idea, or do not believe in them. And most of the time they argue about the variables, loops, or switches. But, I strongly believe that if you do not speak the pattern language, your software will not go far and you will find yourselves in a maintenance nightmare.    </p>\n\n<p>As you know, anti-pattern is also dangerous thing and it happens when you have little expertise on design patterns. And refactoring anti-patterns is much more harder. As a recommended book about this problem please read "AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis".</p>\n'}, {'answer_id': 12970510, 'author': 'Anders Johansen', 'author_id': 1460495, 'author_profile': 'https://Stackoverflow.com/users/1460495', 'pm_score': 1, 'selected': False, 'text': "<p>Yes.</p>\n\n<p>We are even using them in my current job: Mainframe coding with COBOL and PL/I. </p>\n\n<p>So far I have seen Adaptor, Visitor, Facade, Module, Observer and something very close to Composite and Iterator. Due to the nature of the languages it's mostly strutural patterns that are used. Also, I'm not always sure that the people who use them do so conciously :D</p>\n"}]
['https://Stackoverflow.com/questions/11586', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/322/']