30.2 Design
If
you come to a choice between a relatively "quick
hack" or a somewhat more involved but more flexible
solution, always go for the more flexible solution.
You're more likely to reuse it or learn from it.
You're also more likely to be thankful later on when
requirements shift a little and your code is ready for it.
Never trust any user input to be what you expect. What would your
program do at any given point if a cat walked across the keyboard,
several times?
Watch out for signed unsigned conversions and overflow/underflow
conditions.
|