Reduce the size of methods

From CSSEMediaWiki
Revision as of 01:10, 18 August 2009 by Stephen Fitchett (Talk | contribs)
Jump to: navigation, search

In general, a small method is a good method. Not only is a small method an easier chunk of logic for a programmer to understand, it makes subclassing easier. Large methods in superclasses will often be partly correct for subclasses, but not completely correct. This means that the subclass has to re-write the whole method, even if most of it is correct. If your superclass only has small methods, it is easier to change its behaviour in subclasses. Small methods are therefore an important part of software reusability.

See Also

Personal tools