Singleton பேட்டர்ன் ஒரு class-க்கு ஒரே ஒரு instance மட்டுமே இருக்க உறுதி செய்கிறது மற்றும் அதற்கு global access point வழங்குகிறது. ஒரு object மட்டும் ஏதோ ஒன்றை (configuration, connection pool, logger) coordination செய்ய வேண்டிய சமயங்களில் இது பயன்படுத்தப்படுகிறது, இருப்பினும் இது சற்று சர்ச்சைக்குரியதாகவும் உள்ளது.
Singleton என்ன செய்கிறது
SINGLETON → guarantee a class has only ONE instance, with global access to it:
→ the class controls its own instantiation (private constructor)
→ returns the SAME instance every time it's requested
→ for: things there should only be ONE of, accessed from many places
