Singleton Pattern
ELI5 — The Vibe Check
Singleton says: 'this class shall have exactly ONE instance, ever.' Database connections, config objects, loggers — things you only want created once. Every time you call getInstance(), you get the same object back. Simple in theory. In practice, it's basically a global variable wearing a tuxedo, and testing it is a nightmare.
Real Talk
undefined
When You'll Hear This
undefined
Related Terms
Dependency Injection
Instead of your UserService creating its own DatabaseConnection (tight coupling), you pass the database in from outside: new UserService(db).
Factory Pattern
You want to create a 'notification' object but it might be an EmailNotification, SMSNotification, or PushNotification depending on user preferences.
Observer Pattern
Think of a newsletter. You (the publisher/subject) publish content. Your subscribers (observers) automatically get notified when new content arrives.