Scale Forem

Scale YouTube
Scale YouTube

Posted on

CodeOpinion: You Don’t Need an Interface for Everything

TL;DR

You probably don’t need an interface for every service—if there’s only one implementation, it’s just extra boilerplate. Instead, lean on delegates or simple class overrides when you actually need flexibility and use interfaces only for true plug-in points or swap-outs.

This interface-overuse habit comes straight from how .NET Dependency Injection is often taught (“always program to an interface”), but it’s more of a guideline than a rule. Know when to skip the interface and write clearer, more concise code.

Watch on YouTube

Top comments (0)