Yo-yo problem
From CSSEMediaWiki
(Difference between revisions)
m |
m (Reverted edits by Ebybymic (Talk); changed back to last version by Bertrand Roussel) |
(One intermediate revision by one user not shown) |
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