YAGNI—“You aren’t gonna need it”—means postponing functionality and structural changes until a real need exists. Avoid speculative interfaces, features, and flexibility. section 8.4
Speculative work carries opportunity cost: requirements may change before the feature is needed, forcing rework while increasing code and ownership costs. Simpler, smaller solutions usually offer better returns. section 8.4
Apply the principle with these rules:
- Do not add an interface merely to enable an imagined future implementation; a single implementation is not a genuine abstraction. section 8.4
- Implement the required behavior directly, then discover and extract abstractions when multiple implementations create a real need. section 8.4
public interface IMessageBus public class MessageBus : IMessageBus public interface IUserRepository public class UserRepository : IUserRepository
Compare interfaces with their sole implementations to spot structure introduced only for hypothetical flexibility. section 8.4


