Talk:Multiton pattern
Java Start‑class Low‑importance | |||||||||||||
|
Computer science Start‑class Low‑importance | |||||||||||||||||
|
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)
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)
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)
- 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)
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)
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?