Send messages to components instead of to self
From CSSEMediaWiki
(Difference between revisions)
(New page: For an inheritance-based framework, behaviors achieved by overridden method is better to be replaced by encapsulate these methods into components, hence a component-based framework will be...) |
|||
Line 1: | Line 1: | ||
− | For an inheritance-based framework, | + | For an inheritance-based framework, behaviours that can be achieved by overriding methods are better achieved by encapsulating these methods into components. It can help the framework to be able to work with pluggable objects, and it helps to increase the cohesion and generality of such a framework. [[Johnson and Foote 1988]] suggest that this kind of refactoring should be done whenever possible. As an example, they give sorting methods which often take parameters describing how to compare objects, as opposed to subclasses for each kind of comparison that could be performed. |
+ | |||
+ | [[Category: Johnson and Foote's heuristics]] |
Revision as of 01:40, 18 August 2009
For an inheritance-based framework, behaviours that can be achieved by overriding methods are better achieved by encapsulating these methods into components. It can help the framework to be able to work with pluggable objects, and it helps to increase the cohesion and generality of such a framework. Johnson and Foote 1988 suggest that this kind of refactoring should be done whenever possible. As an example, they give sorting methods which often take parameters describing how to compare objects, as opposed to subclasses for each kind of comparison that could be performed.