Talk:Software design pattern

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computing (Rated Start-class, High-importance)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 High  This article has been rated as High-importance on the project's importance scale.
 
WikiProject Computer science (Rated Start-class, High-importance)
WikiProject icon This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 High  This article has been rated as High-importance on the project's importance scale.
 

The title[edit]

As stated in the first paragraph, design pattern is more software engineering artifact than computer science. Or choose the third option: computation. — Preceding unsigned comment added by Kejia (talkcontribs) 18:16, 12 December 2010 (UTC)

Making the list its own page[edit]

Maybe in the next couple of days unless someone reasonably disagrees. --Daydreamer302000 (talk) 11:29, 8 June 2009 (UTC)

I think Design Patterns should include examples of all language, which is very useful in order to understand the pattern.—Preceding unsigned comment added by 207.46.92.16 (talkcontribs) 02:19, 10 June 2009

Extraneous examples[edit]

The many pages for specific Design Patterns have a chronic excess of examples. Many pages are more than 80% example; at least one pattern has examples in 13 languages with a total of 16 examples! While some examples are different in important ways between families of languages (such as strongly-typed versus dynamically-typed), I have a strong feeling that language advocates are adding me-too examples that detract from explaining the particular pattern. I think Java is probably the best example language for OO design patterns since Java examples won't be cluttered with memory-management code but are strongly typed, so it is clear what inherits what. Full disclosure: My own personal languages of choice are C++ and Python and I am not too familiar with Java. I've changed a few algorithm examples from pseudocode to Python when a working Python example could be almost as easy to understand as pseudocode. However, for OO design patterns, I really think a widely-used strongly-typed garbage-collected language is most appropriate, and that leaves me with Java.

If people feel strongly about having examples in every possible language, I would argue that the examples should be forked off onto separate pages or moved to wikibooks. But certainly 16 examples in 13 languages is not the best way to describe the singleton pattern. —Ben FrantzDale (talk) 13:47, 8 April 2009 (UTC)

I agree with you. Feel free to remove examples that do not add to the explanation of the pattern. --Antonielly (talk) 13:53, 8 April 2009 (UTC)
say hello to the world — Preceding unsigned comment added by 61.4.76.7 (talk) 03:37, 29 October 2014 (UTC)
I went ahead and was bold, linking all edits back to this discussion. I'm sure I pissed off a few people, but this really had to be done. I left one example as PHP5 because it was the only concise example. I erased hours and hours of work. Again, if people want to dig it back out, wikibooks is probably a good place for it. Wikipedia should be the tip of the iceburg and shouldn't dwell on language-specifics on these topics unless the specifics are very relevant to the patterns. There are still some pages with long lists of links to implementations in various languages. —Ben FrantzDale (talk) 00:11, 9 April 2009 (UTC)
I also agree, so many code examples added nothing. Also, this is coherent with Wikipedia is not a How-to guide policy. --Enric Naval (talk) 03:45, 9 April 2009 (UTC)

I just noticed that this has apparently pissed off at least one unregistered user. It wasn't me, but I agree that we should create a place for it withough bombing all that content out of existence. Thanks. 122.29.47.35 (talk) 11:07, 13 April 2009 (UTC) Sorry, I was referring to the Singleton article specifically, but yeah, it applies to all I guess. 122.29.47.35 (talk) 11:08, 13 April 2009 (UTC)

That would be 61.115.196.46, whose reversion carries the comment "There was an idiot who removed the examples for all languages other than Java. I had depended on this to create singleton for my projects and only to find they were deleted by one idiot.". But it doesn't change the fact that Wikipedia is not a programming textbook. The purpose of these articles should be to explain what design patterns are in general and to explain the specific patterns in general terms, not to provide libraries of source code for cut and paste usage. I have undone their reversion. RossPatterson (talk) 11:31, 13 April 2009 (UTC)
Seriously. If someone depended upon the examples for their project, they certainly would have understood the Java version and applied it in the language of choice. Unless 61.115.196.46 is just copy/pasting from Wikipedia instead of programming ;-) —Ben FrantzDale (talk) 11:35, 13 April 2009 (UTC)
Be bold and move them to Wikibooks! If you do, add links to them here. —Ben FrantzDale (talk) 11:35, 13 April 2009 (UTC)
If you wanted to be bold enough to delete all the examples, you should have also moved them to wiki books. I understand your motivation, but you shouldn't do the destructive work without doing the constructive work in turn. — Preceding unsigned comment added by 192.35.35.34 (talk) 23:59, 12 August 2011 (UTC)
I'm user 201.253.239.87 now(dynamic IP), I've undone BenFrantzDale's Visitor Pattern revision (Reason: "One is not enough for me (but shorter/minimalistic exampleS would be)" in response to BenFrantzDale's "Removed C++ and D examples. One is enough." and later I found this discussion. I think examples implemented in a language are good for learning, both the language(it shows features about it) and the pattern. I think the examples should have been moved elsewhere(eg. wikibooks) and linked to before removal. —Preceding undated comment added 05:28, 15 April 2009 (UTC).
I agree wikibooks is probably the best place for these. Knowing the pattern quite well I can't really see any difference between the examples, each has CarElementVisitor and CarElement interfaces/structs and a few classes implementing these. The rest is just baggage which obscure the pattern. I've now copied the examples to wikibooks at [1]. --Salix (talk): 09:05, 15 April 2009 (UTC)
Great, thanks! That seems like it should keep everyone happy and avoid discarding peoples' hard work. —Ben FrantzDale (talk) 13:21, 15 April 2009 (UTC)

On the Visitor pattern page, i have moved the wikibooks template to the example section, and changed its text to more clearly indicate that there are more examples there. Is it okay to have all the affected pages edited in a similar way? -- Jokes Free4Me (talk) 19:53, 15 April 2009 (UTC)

Yes, I'd say so. That looks pretty good to me. RossPatterson (talk) 22:38, 15 April 2009 (UTC)
Looks good. I just rephrased the link to say "Visitor implementations in various languages" which reads better to my eyes. I started the same for Singleton, moving all examples I erased earlier. Great progress! —Ben FrantzDale (talk) 00:47, 16 April 2009 (UTC)
Can some wise mind add well documented critisms? —Preceding unsigned comment added by 192.193.221.141 (talk) 14:59, 29 April 2009 (UTC)
Adding link to wikibooks on Observer pattern page —Preceding unsigned comment added by Ariadie (talkcontribs) 08:49, 12 May 2009 (UTC)

Just added POSA2[edit]

Hi there, I just added

D, Schmidt; M., Rohnert, H., Buschmann, F. (2000). Pattern-Oriented Software Architecture, Volume 2: Patterns for Concurrent and Networked Objects. John Wiley & Sons. ISBN 0-471-60695-2. 

I believe many of the cuncurrent patterns in the table come from this book, it would be nice to add a column for that. Cheers. 122.29.47.35 (talk) 11:22, 13 April 2009 (UTC)

Done 123.224.241.172 (talk) 14:48, 25 April 2009 (UTC)
Hmm, it would be better to have just POSA and then write e.g. "1" or "2" or "no" in the column. I just added MVC and according to Amazon book search, MVC is in POSA1. Stachelfisch (talk) 20:46, 3 July 2009 (UTC)

Fundamental pattern category[edit]

I'm not sure about considering encapsulation, inheritance, and exceptions to be design patterns. Encapsulation and inheritance are general directions for structuring code more than they are patterns, re-usable elements of software. They are philosophies more than patterns or blueprints. Patterns (not limited to computer science) must be unanimously recognizable. For example, an architectural design's use of the golden ratio is non-disputable. I've never seen "fundamental patterns" used anywhere outside of that cited college lecture presentation and the book it cites, Barbara Liskov's "Program Development in Java". It strikes me that the author wished to coin a new term; perhaps someone who read it can provide another opinion. My [query] yielded few relevant results. Has the term 'fundamental pattern' gained community acceptance or popular usage? And if so, do—and why do—encapsulation and inheritance qualify? Any thoughts? Also, the page Fundamental pattern lists Proxy pattern, Facade pattern, and Composite pattern; all three of which are listed as structural patterns in this page; and it doesn't list inheritance or encapsulation.  dmyersturnbull talk 03:59, 4 June 2009 (UTC)

If there are no objections, I'll place the neologism template:
for the reason cited above. Also, if its contradiction to Fundamental pattern is not resolved, I think adding contradict-other is warranted:
 dmyersturnbull talk 06:58, 10 July 2009 (UTC)

I would remove everything referring to "fundamental patterns". They simply don't belong. "Design Patterns" (ISBN-10: 0201633612) is 15 years old and surely one of the seminal works. It's still in print. It catalogs ~15 patterns from factory to vistor. That's what the term normally encompasses and what wikipedia should document.

How to distinguish between a pattern and something like inheritance? There's no direct support for a pattern in any language. That's *why* they're patterns: because many programmers, facing diverse problems in a variety of languages, hit upon similar ways -- patterns -- of addressing them.

I disagree with the other cautionary note, though, that suggests criticism should be integrated into the document. The "other school of thought" should have its own section to allow main section to make its case.

jklowdentalk Tue Jul 14 21:36:24 EDT 2009 —Preceding undated comment added 01:37, 15 July 2009 (UTC).
There are source defining similar concepts. See chapter 2.3.1 of Meta-Compilation for C++ [2] which also provide further references. I believe dmyersturnbull has many excellent points worth pursuing. As more people study a concept deeper understanding is found. Just because an seminal work refers to something doesn't mean a field can not progress beyond it. Other wise the argument would be mute as we would all program in MIX. Bpringlemeir (talk) 01:41, 16 July 2010 (UTC)
Err, I guess I don't agree with dmyersturnbull (and apparently I can not read). Anyways, the reference above is worth looking at if you are pursuing this. There is literature where people try to dissect the universal nature of a pattern. As with the multiple language example above, an excess of things named patterns can dilute as well. Bpringlemeir (talk) 01:48, 16 July 2010 (UTC)
"Encapsulation and inheritance are general directions for structuring code..." In other words, patterns?! This looks like the very definition of a pattern! GeneCallahan (talk) — Preceding undated comment added 18:15, 23 December 2014 (UTC)

Why is Factory not listed?[edit]

It has its own page on wikipedia as being a creational pattern. —Preceding unsigned comment added by 208.127.236.194 (talk) 15:00, 14 August 2009 (UTC)

(Resolved, Factory method now listed)

Should Multiton be listed?[edit]

As noted on the Multiton "talk" page, Multiton seems to be interchangeable with the "Flyweight Pattern" - the code examples are interchangeable. It seems as if it's just an alternate name for the same pattern, put into a different category. — Preceding unsigned comment added by 38.70.1.35 (talk) 04:20, 5 September 2012 (UTC)

Enterprise Integration Patterns[edit]

These patterns belong here and should also have their own page in wiki! What do you think? more here: Integration Patterns

Azbarceatalk Fri Jun 11 09:55:24 UTC 2010 —Preceding undated comment added 08:56, 11 June 2010 (UTC).

Criticism section[edit]

An anon removed the cricicism section [3] iwith the comment

(Moved valid information out of a criticisms section into the rest of the article. In the process, removed information that was the result of the writer's personal ignorance.)

The remove material is

Criticism[edit]

In the field of computer science, there exist some criticisms regarding the concept of design patterns.

Workarounds for missing language features[edit]

Users of dynamic programming languages have discussed many design patterns as workarounds for the limitations of languages such as C++ and Java.[1]

For instance, the Visitor pattern need not be implemented in a language that supports multimethods. The purpose of Visitor is to add new operations to existing classes without modifying those classes. In C++, a class is declared as a syntactic structure with a specific and closed set of methods. In a language with multimethods, such as Common Lisp, methods for a class are outside of the class structure, and one may add new methods without modifying it.

Similarly, the Decorator pattern amounts to implementing dynamic delegation, as found in Common Lisp, Objective-C, Self and JavaScript.

Many patterns imply object-orientation or more generally mutable state, and so are meaningless in functional programming style, in which data is immutable or treated as such. For example, the Iterator pattern is a generalisation of 'for' loops, an inherently imperative notion.

Does not differ significantly from other abstractions[edit]

Some authors [who?] allege that design patterns don't differ significantly from other forms of abstraction[citation needed], and that the use of new terminology (borrowed from the architecture community) to describe existing phenomena in the field of programming is unnecessary. The Model-View-Controller paradigm is cited as an example of a "pattern" that predates the concept of "design patterns" by several years.[2] It is further argued by some[who?] that the primary contribution of the Design Patterns community (and the Gang of Four book) was the use of Alexander's pattern language as a form of documentation; a practice that is often ignored in the literature. [citation needed]

should any of this be restored?--Salix (talk): 08:09, 4 November 2010 (UTC)

I'd say, go ahead and re-include this section. Perhaps it's not the best sourced right now, but there are pieces of criticism published out there; let's hope more links will be added soon enough. One thing comes to my mind, Paul Graham's

For example, in the OO world you hear a good deal about "patterns". I wonder if these patterns are not sometimes evidence of case (c), the human compiler, at work.

(from http://www.paulgraham.com/icad.html); perhaps the discussion at http://www.c2.com/cgi/wiki?AreDesignPatternsMissingLanguageFeatures is a good start too. Dexen (talk) 16:50, 19 November 2010 (UTC)
As it currently stands the criticism section is based on irgnorance; it criticises the 'concept' of patterns. That is like criticising the 'concept' of solutions or answers to questions or formula. (Software/Design/Architecture) Patterns are solutions documentation in relativity consistent way. Individual patterns may be 'poor' or 'wrong' but that makes them anti-patterns or poor solutions, it doesn't make the concept of patterns wrong, if anything it justifies them further. MartinSpamer (talk) 07:22, 27 November 2011 (UTC)
Your phrasing seems to conform to the criticism that "design patterns" are hardly new. "That is like criticising the 'concept' of solutions or answers to questions or formula.". What /isn't/ a solution or answer? (Software) engineers as I understand them apply knowledge to solve problems. It follows then there have always been "design patterns" as long as there have been (software) engineers, and thus "design patterns" existed long before the Gang of Four. But maybe you mean something more specific than just knowledge. But then again, maybe not. A solution, good or bad, addresses some problem. Documentation records this solution in a form that can be transmitted to someone else. A "relatively consistent way" could in the extreme mean totally consistent, like some kinds of logic, or something totally free-formed, like some kinds of art (and yes, people have been inspired to create and document a solution based on an encounter with art). If these are "(Software/Design/Architecture) Patterns", then I claim first you are correct that "it doesn't make the concept of patterns wrong", for how can a concept be wrong?, and second, that one part of the criticism section is actually valid because the concept /of a concept/ is hardly new (though for a twist, our /concept/ of a concept has changed over time). In other words, the concept of "design pattern" seems to me indistinguishable from "knowledge", and could thus be stated as: knowledge is documentation of solutions in a relativity consistent way, and pretty much state the same thing. It's quite telling that you put all the adjectives to "patterns" in brackets, suggesting you don't mean just software design patterns, but patterns in general.
(GeorgePaci incidentally stated the same thing about another of Christopher Alexander's ideas, that "QWAN" was a replacement for "good" (… '"That design is good" and rewrites them as "That design has QWAN"'). The same thing here, where "design pattern" replaces "pattern" (or "concept")).
So that I'm not accused of something I didn't say, let me be clear that I too support the concept of documenting solutions in a relatively consistent way (and thus am against "inconsistency", meaning something like "undisciplined", or "ignores previous knowledge (re: patterns) without reason"). However, I don't think all this talk of design patterns has really added much, and perhaps nothing at all, compared to what we would have done had we not borrowed from Alexander's ideas. If he was the first architect to document (repeated) solutions, then good for him. If the Gang of Four was the first to document (software) engineers' knowledge, then good for them. Yet, I don't think that could be the case. That's not to say our ways of recording knowledge have never changed – they have. Rather, (design) patterns might better be thought of (and defined as, one step towards a good /concept/) as documentation to solutions in a /more/ consistent way, more consistent than whatever came before. On this view, a "design pattern" really just looks like a form of organized knowledge, as opposed to being scattered across a million brains and databases, much like Wikipedia is a form of organized knowledge compared to the millions of sources that is (supposedly) cites.
The bottom line is that I would drop all this design pattern talk because there already are burgeoning fields that talk about knowledge. For instance, cognitive scientists would talk about "mental representations", and could ask questions that design pattern people could not, like are some mental representations more "difficult" than others, such as, do they take up more processing time? This could then have relevance to software engineering because it could tell us, somewhat, if some "design patterns" give us more trouble than others). In other words, software design patterns (Gang of Four, Alexander's ideas, etc.) to me seem disconnected from the rest of our knowledge. This is a bad thing. If anything it justifies them less.
tl;dr: software design patterns have become indistinguishable from knowledge or concepts, and all talk of it can be done away with, but what it refers to cannot. KaiSeun (talk) 07:25, 16 February 2012 (UTC)

Paragraph sounds like an ad[edit]

The final paragraph of the history section appears to be an advertisement for SOA Design Patterns. I'm not sure that this book even belongs on the page; it certainly doesn't deserve its own paragraph. EvanKroske (talk) 01:49, 19 November 2010 (UTC)

New list appearance[edit]

I just refactored the list to remove the gigantic red-block columns that were for books that don't even have a wiki page. One was PoEAA and that only had two patterns. The other was PoSA2, which only had concurrency patterns (and the first two columns had no concurrency patterns). I think what I implemented is the best solution for this, which is 1) to separate out the concurrency patterns into its own table with the primary column being PoSA2, and 2) adding an "Other" column, to list the two references to PoEAA as well as any other books that references that may come along for the patterns that currently have no references. I also changed the blank column cells in the "Other" column to the n/a Template to give a better overall appearance. I hope that these changes are helpful. -- Renesis (talk) 23:11, 17 February 2011 (UTC)

Pattern List[edit]

Blackboard is not a design pattern but an communication strategy I suggest to remove this —Preceding unsigned comment added by 80.148.12.242 (talk) 09:28, 7 April 2011 (UTC)

Criticism - Newness[edit]

I don't understand this criticism:

The idea may not be as new as suggested by the authors: for instance the Model-View-Controller paradigm is an example of a "pattern" which predates the concept of "design patterns" by several years.

As far as I know, none of the authors claim that they were the first to create the concept of design patterns. Rather, they claim to be the first to document it explicitly and create a lexicon to talk about them. A citation here would be very useful. —Preceding signed comment added by 67.248.242.179 (talk) 01:43, 20 April 2011 (UTC)

Patterns are discovered not invented -- Christopher Alexander (Author "A pattern language" and originator of the idea of a pattern language) — Preceding unsigned comment added by 92.40.253.45 (talk) 21:35, 31 October 2011 (UTC)

What about Asynchronous Completion Token (ACT)?[edit]

I'm just learning this design pattern and I know nothing about it, but it seems to be a standard for handling things in Flex (or some client) that should be processed after completion of a server process.

"The Asynchronous Completion Token design pattern efficiently dispatches processing actions within a client in response to the

completion of asynchronous operations invoked by the client."

Why RAII included in Design Pattern?[edit]

After reading RAII, it doesn't look like an creational pattern. Can we remove/move it from creation pattern secion?

I support the removal. RAII is more exactly programming idiom, not a design pattern.--Demonkoryu (talk) 09:53, 8 August 2011 (UTC)

design patterns vs algorithms[edit]

If a design pattern is a "a general reusable solution to a commonly occurring problem", then in what way(s) does it differ from an algorithm? This article doesn't do much to explain exactly what a design pattern is. A simple example would be a good start. WilliamSommerwerck (talk) 19:13, 7 September 2011 (UTC)

As a quick answer, I would say that design patterns differ from algorithm in that design patterns solve software engineering problems rather than computer science problems. That is, they are templates for managing complexity that arrives from interaction among software components. There are many ways to implement depth first search, so even though the algorithm may be the same, on implementation may be far preferable from a software-design perspective in terms of software reusability, etc. That's a sketch of an answer, anyway. 20:38, 7 September 2011 (UTC)
Looking up algorithm, it is described as "a finite list of well-defined instructions", I would say that is different enough. Unfortunately, design patterns are an advanced subject and this is partly why explaining them is so difficult. Typically, one or more design patterns may be used in an algorithm solution expressed in a particular computer language. Books are written on the subject.
Like classic Chinese martial arts movies, one needs good kung fu (term), not just basic knowledge of how to move your arms and legs. – rfrankla (talk) 10:42, 21 April 2014 (UTC)

Creating a new category[edit]

I am concerned with software design patterns for a few month now. One reason is for educational purposes, creating a lecture with Moodle. There are a lot of design patterns, but somehow the ones defined in the Design Patterns book are taught often first. To help those interested in teaching the subject (to themselves, why not?) or who are interested in the history of this subject, I propose to add a category called Category:GoF pattern or something like that so that all 23 patterns are in one category. As the default place, I will add the Design Pattern book article. What is your opinion? Sae1962 (talk) 15:57, 26 July 2012 (UTC)

Generally support. I'd change the name to Category:Gang of Four design patterns though. This category name should be plural, and spelling things out in full is generally clearer to naive readers.
Also note that if you use the leading colon, you can link to categories without needing the <nowiki> markup. Andy Dingley (talk) 16:08, 26 July 2012 (UTC)

See Also section[edit]

Design patterns and TRIZ are similar in that they both define solutions to common problems. A see also section might be an interesting side road. — Preceding unsigned comment added by Billegge (talkcontribs) 12:23, 24 October 2012 (UTC)

delete[edit]

delete

" types of design patterns" vs "classification"[edit]

redundant (but with diffferent types), or just no explanation of the difference? 68.183.23.147 (talk) 23:38, 16 January 2013 (UTC)

No one has fixed it after more than a year. Any reasonable objection to deleting the "types"?

In Design Patterns/Code Complete - WTF[edit]

Not that I have anything against these references, but why on earth should the presence or not of a particular pattern in these books matter? There are numerous patterns that were identified before and after these which aren't included. This section reads like religion, not software engineering. — Preceding unsigned comment added by 81.129.62.42 (talk) 01:43, 15 September 2013 (UTC)

Prior to the publication of GOF little was known on the subject. The authors wanted to provide a standard vocabulary for practitioners to communicate their thoughts and ideas. To begin the process they purposely chose "some of the most important design patterns and present them as a catalog."[3] (I'm being informal because this is the talk page). By virtue of the number of copies sold and the acceptance by software engineers of these ideas, these book are the acknowledged references on the subject. – rfrankla (talk) 09:34, 21 April 2014 (UTC)
I agree - whether a pattern is in some book or another is completely irrelevant. It's like listing birds that are found in one particular field guide. — Preceding unsigned comment added by 68.183.37.167 (talk) 14:32, 28 May 2014 (UTC)

Proactor[edit]

Should proactor be listed?

delegation pattern[edit]

has its own article, but not listed here?!

External links moved to talk[edit]

Looks like we've created a WP:LINKFARM. I've moved all the links from the article to the list below. Anyone want to go through this mess and see if anything fits WP:EL well enough to include? --Ronz (talk) 17:41, 13 June 2014 (UTC)

External link to w3sdesign.com[edit]

The w3sDesign Patterns website contains encyclopedic and accurate material that is relevant to the understanding of the subject. I would like to add a link to it. What do others think about it? Serv49 (talk) 18:16, 23 October 2014 (UTC)

I have added the link. Serv49 (talk) 10:05, 6 November 2014 (UTC)

Languish?[edit]

"Although design patterns have been applied practically for a long time, formalization of the concept of design patterns languished for several years..."

Languished? For several years? I *think* what is meant here is that "Although design patterns have been applied practically for a long time, it was only recently that they were formalized." GeneCallahan (talk) 18:34, 23 December 2014 (UTC)

  1. ^ Peter Norvig, in Design Patterns in Dynamic Programming, discusses the triviality of implementing various patterns in dynamic languages. Norvig, Peter (1998-03-17). "Design Patterns in Dynamic Programming". Retrieved 2007-12-29.  Norvig and others have described language features that encapsulate or replace various patterns that a C++ user must implement for themselves.
  2. ^ Reenskaug, Trygve. "MVC XEROX PARC 1978-79". Retrieved 2008-06-09. 
  3. ^ GOF page 2