Yo-yo problem
From CSSEMediaWiki
(Difference between revisions)
JaninaVoigt (Talk | contribs) (Created page about yo-yo problem anti pattern) |
m |
||
Line 9: | Line 9: | ||
*[[Limit hierarchy depth]] | *[[Limit hierarchy depth]] | ||
*[[Favor composition over inheritance]] | *[[Favor composition over inheritance]] | ||
+ | |||
+ | {{Design Anti-patterns}} | ||
+ | [[Category: Anti-Patterns]] |
Revision as of 02:26, 22 July 2009
The yo-yo problem anti-pattern occurs when a programmer is working with a program where the inheritance hierarchy structure is deep and confusing so that the programmer has to constantly switch between classes in the hierarchy to keep track of what's happening in the program. It is called the yo-yo problem because the programmer's attention continually moves up and down the hierarchy as he looks at different classes.
This is one of the reasons why it is often recommended that inheritance hierarchies should be limited in depth to about six or so levels.
Liabilities
- The deep and complicated class hierarchy makes it difficult to trace the flow of control in a program and makes the program harder to understand overall.
Related design heuristics