Content deleted Content added
sources for GoF, can't find a source that says "registry of singletons" is actually the same pattern though |
m →Drawbacks: HTTP to HTTPS for Blogspot |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 3:
In [[software engineering]], the '''multiton pattern''' is a [[design pattern (computer science)|design pattern]] which generalizes the [[singleton pattern]]. Whereas the [[singleton pattern | singleton]] allows only one instance of a class to be created, the multiton pattern allows for the controlled creation of multiple instances, which it manages through the use of a [[associative array|map]].
Rather than having a single instance ''per application'' (e.g. the {{Javadoc:SE|package=java.lang|java/lang|Runtime}} object in the [[
The multiton pattern does not explicitly appear as a pattern in the highly regarded [[object-oriented programming]] textbook ''[[
==Description==
Line 15:
==Drawbacks==
This pattern, like the [[Singleton pattern]], makes [[unit testing]] far more difficult,<ref>{{Cite web | url=
With garbage collected languages it may become a source of memory leaks as it introduces global strong references to the objects.
Line 63:
public override string ToString()
{
return $"My type is
}
// Sample usage
public static void Main(string[] args)
{
Console.WriteLine(m0);
|