software system design Describe the pattern Nton extension o
software system design..
Describe the pattern N-ton (extension of our discussion on singleton- class managing n objects of its own class). Explain how the class manages its own instances and prevents clients from cheating (creating their own objects of that class). Provide psudo-code.
Solution
In software engineering, n-ton pattern is a design pattern similar to singleton pattern, where a singleton class allows only one instance of a class to be created. The n-ton expands this concept of singleton pattern and manages n objects of its own class by keeping a map of named instances of key value pairs.
Hence, rather than having a single instance per application, the n-ton instead has single instance per key.
Also, the n-ton does not allow clients to add mappings. Since the object pool is created only once, the client cannot make any changes to the mappings.
This can be implemented using a hashmap or an enum, etc.
