Daily iOS
Testing

Architecture that invites tests

One item the architecture round scores is "can you add unit tests without a big refactor". Which design decisions satisfy that condition, with an example?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

The key is a boundary that keeps business logic from knowing the frameworks (UIKit, SwiftUI, URLSession, Core Data) directly. Define dependencies as protocols and inject them through the initializer, express state transitions with pure functions and value types, and inject nondeterministic things like time, randomness, and UUID.

Share a question