Anticipating Change vs. Over-Engineering
What you'll learn: How to prepare for likely changes without building complicated solutions for problems that may never happen.
The Core Tension
You've learned that software must be designed for change (lesson 186), but there's a delicate balance to strike. Anticipating change means identifying likely modifications and making them easier to implement. Over-engineering means adding complexity to handle unlikely scenarios "just in case."
The difference is probability and cost.
Think Like a Builder
Imagine building a house. You install electrical outlets knowing people will plug things in (likely change). You don't install a backup power generator, underground bunker, and helipad unless you have specific reasons to expect you'll need them (over-engineering).
In software, anticipating change might mean:
- Using interfaces so you can swap database implementations later (reasonable)
- Keeping business logic separate from UI code (smart)
Over-engineering might mean:
- Building a plugin system for a feature only you will use
- Creating 15 configuration options for something that could be a constant
- Abstracting every single detail "for flexibility"
How to Decide
Ask yourself:
- What's the evidence? Do requirements hint at this change? Have stakeholders mentioned it?
- What's the cost? Does this flexibility make the code harder to understand now?
- Can you add it later? If the change happens, how hard is it to adapt?
Remember YAGNI (You Aren't Gonna Need It) and KISS (Keep It Simple, Stupid): favor simplicity unless you have concrete reasons to expect change.
Key Takeaway: Design for changes you have good reason to expect, but resist the urge to build elaborate solutions for hypothetical futures—simplicity today beats complexity for scenarios that may never arrive.