Badoo Dec 5, 2017

Singleton, Service Locator and Tests in iOS

Article Summary

Bohdan Orlov from Bumble Tech tackles one of iOS development's most controversial debates: are Singletons and Service Locators actually anti-patterns, or just misunderstood tools?

This deep dive from Bumble's engineering team examines why Singletons and Service Locators earn their bad reputation in iOS codebases. The article walks through practical examples of how these patterns break testability and create hidden dependencies, then offers concrete solutions for using them safely.

Key Takeaways

Critical Insight

Singletons and Service Locators aren't inherently bad, but they must be confined to factory layers and injected explicitly to maintain testability.

The article reveals a clever architectural constraint that makes it physically impossible for junior developers to misuse your Service Locator, even accidentally.

Recent from Badoo

Related Articles