Refactoring Workbook

"You aren't gonna need it." “Ron Jeffries

Code is sometimes more complicated than it has to be to solve the problem at hand. There are two causes for this problem:

  • Sometimes code gets complicated for historical reasons (e.g., there can be code rot ” the leftovers from old ways of doing things), but it no longer needs the complexity.

  • Another cause of complexity is the practice of overgeneralizing the design. This is often in anticipation of future requirements, or premature performance tuning.

Remove these problems when you run into them. You'll often find that this can lead to further insight and simplification.

Категории