22. TEMPLATE METHOD and STRATEGY: Inheritance versus Delegation
© Jennifer M. Kohnke
The best strategy in life is diligence.
—Chinese proverb
In the early 1990s—in the early days of OO—we were all quite taken with the notion of inheritance. The implications of the relationship were profound. With inheritance, we could program by difference! That is, given a class that did something almost useful to us, we could create a subclass and change only the bits we didn’t like. We could reuse code simply by inheriting it! We could establish whole taxonomies of software structures, each level of which reused code from the levels above. It was a brave ...
Get Agile Principles, Patterns, and Practices in C# now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.