Youre NOT gonna need it!
Often you will be building some class and youll hear yourself saying "Were going to need...".
Resist that impulse, every time. Always implement things when you actually need them, never when you just foresee that you need them. Heres why:
- Your thoughts have gone off track. Youre thinking about what the class might be, rather than what it must be. You were on a mission when you started building that class. Keep on that mission rather than let yourself be distracted for even a moment.
- Your time is precious. Hone your sense of progress to focus on the real task, not just on banging out code.
- You might not need it after all. If that happens, the time you spend implementing the method will be wasted; the time everyone else spends reading it will be wasted; the space it takes up will be wasted.
You find that you need a getter for some instance variable. Fine, write it. Dont write the setter because "were going to need it". Dont write getters for other instance variables because "were going to need them".
The best way to implement code quickly is to implement less of it. The best way to have fewer bugs is to implement less code.
Youre not gonna need it!
© 1997, 1998, Ronald E Jeffries