Send messages to components instead of to self

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
(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...)
 
m (Reverted edits by Ebybymic (Talk); changed back to last version by TobiW)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
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 the result. Johnson and Foote suggest this kind of refactoring is always needed, and such changes should be applied whenever it is possible. 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.
+
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.
 +
 
 +
This is similar to [[Favor composition over inheritance]] maxim.
 +
 
 +
[[Category: Johnson and Foote's heuristics]]

Latest revision as of 03:05, 25 November 2010

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.

This is similar to Favor composition over inheritance maxim.

Personal tools