Jump to content

Talk:Multiton pattern

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by KnockNrod (talk | contribs) at 16:07, 21 September 2010 (Multiton = Singleton Collection?: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

WikiProject iconJava Start‑class Low‑importance
WikiProject iconThis article is within the scope of WikiProject Java, a collaborative effort to improve the coverage of Java 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.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.
Note icon
This article has been automatically rated by a bot or other tool because one or more other projects use this class. Please ensure the assessment is correct before removing the |auto= parameter.
WikiProject iconComputer science Start‑class Low‑importance
WikiProject iconThis 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.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.
Things you can help WikiProject Computer science with:

Multiton an Antipattern? Please explain here

Pending further discussion here, I removed a strange assertion that multiton is viewed as an antipattern by "advocates of dependency injection". I for one often advocate dependency injection, while also often using multiton (albeit not with statics) on the same project e.g. when deserializing some richly interelated data that had to pass through some intermediate format that had little direct ability to express relationships. These days, relational data passing through an XML format is a common example, since XML expresses hierarchy only while relational supports more general network graphs that may need to be reassembled by keying off instance IDs. If someone wants to put it back, please explain here first so we can discuss. Bmord (talk) 20:07, 7 January 2010 (UTC)[reply]

The quote within this 'Multiton' article currently states: "multiton does not appear in Design Patterns, the highly-regarded object-oriented programming text book". But it actually does appear in the GoF book under then name "Flyweight pattern" (http://en.wikipedia.org/wiki/Flyweight_pattern). I believe that these articles should be merged, and if not merged, then at least cross reference each other. Another identical concept by yet another name is 'Hash consing' (http://en.wikipedia.org/wiki/Hash_consing), but at least the Flyweight pattern article and the Hash consing articles do cross-link to each other. This 'Multiton' article should be brought into the loop as well, and the sentence stating that 'Multiton' does not appear in the GoF should be corrected to state that it *does*, but under the name "Flyweight pattern". - MR 2010 0408 —Preceding unsigned comment added by 72.229.25.188 (talk) 12:16, 8 April 2010 (UTC)[reply]

NOT double-checked locking

The example code is not vulnerable to the double-checked locking anti-pattern. I have updated the double-checked locking page to make the problem more clear.

Right: http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html, example 2. Pavel Vozenilek 22:16, 19 December 2005 (UTC)[reply]
That's correct; the example code bears the full cost of synchronization - what the double-checked locking [anti-]pattern set out to avoid. 71.253.235.250 01:44, 6 April 2006 (UTC)[reply]

Please discuss changes here first

For the second time I have had to remove incorrect commentary on this subject. Please add discussion here if you have questions.

Dubwai 15:52, 19 June 2006 (UTC)[reply]

Multiton = Singleton Collection?

How does the Multiton differ from a Singleton Collection? Basically, there's one collection, instead of one object. Perhaps this is why the GoF mentioned it only as a footnote to the Singleton?

Also, I see the lock in the C# example, but I thought that static variables were guaranteed thread-safe. Besides wasting clock cycles, what does the lock buy you?