Mid SOLID

What are anti-patterns related to DI and Singleton?

  • Service Locator anti-pattern: Hides dependencies instead of injecting them

explicitly.

  • Overusing Singleton: Leads to hidden global state and testing difficulties.
  • Improper Singleton thread safety: Causes race conditions.
  • Injecting concrete implementations: Violates DIP.

More from Design Patterns in C#

All questions for this course