I found a little essay, 'On Generalization', which is good but should have been titled 'On Premature Generalization' -- which deserves to be recognized as an anti-pattern. The nut of this essay is that generalization is a form of prediction, which is a nice way of putting it; the obvious inference is that premature generalization is the equal and opposite error of premature optimization, which as we all know is evil. Inappropriate generality and inappropriate particularity can both get us into trouble and waste a lot of time, but the problem is not the generality or the particularity but rather the impropriety -- attempting to fit the future to an ideal that turns out to be irrelevant.
What would be more helpful is guidance on when to generalize or to particularize, in the vein of the 'design patterns' way of thinking. Some very rough guidance can be found in Christopher Alexander's notion that each pattern -- that is, each generalization -- arises naturally in response to tensions among desiderata, and is a way of coordinating the forces naturally present in a way that relieves the tension. So the most general answer is: examine the context, and ask what problem you're actually trying to solve, and why.
(Addendum: Subsequently found this quote from Emil Persson: 'Premature optimizations can be troublesome to revert, but premature generalizations are often near impossible.' This gets to the heart of the matter much more concisely: the information thrown away in any act of abstraction is not, in general, easily recoverable. Deleting is easy; rebuilding is hard.)
No comments:
Post a Comment