Yo-yo problem
From CSSEMediaWiki
(Difference between revisions)
JaninaVoigt (Talk | contribs) (Created page about yo-yo problem anti pattern) |
m (Reverted edits by Ebybymic (Talk); changed back to last version by Bertrand Roussel) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
*[[Limit hierarchy depth]] | *[[Limit hierarchy depth]] | ||
*[[Favor composition over inheritance]] | *[[Favor composition over inheritance]] | ||
+ | |||
+ | {{Design Anti-patterns}} | ||
+ | [[Category: Anti-Patterns]] |
Latest revision as of 03:10, 25 November 2010
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