Yo-yo problem

From CSSEMediaWiki
Revision as of 04:11, 21 July 2009 by JaninaVoigt (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

Personal tools