Change Unidirectional Association to Bidirectional
From CSSEMediaWiki
(Difference between revisions)
Brett Ward (Talk | contribs) (Page Outline Added) |
m (Reverted edits by Ebybymic (Talk); changed back to last version by Brett Ward) |
(One intermediate revision by one user not shown) |
Latest revision as of 03:11, 25 November 2010
If you have two classes that need to use each other's features, but the link currently goes one way, change the association to bidirectional to allow needed navigation.
This refactoring uses back pointers to implement the needed bidirectionality. This pointer will be added as a field. Decisions will also need to be made on which class controls the association, with the non-controlling side needing a helper method. The existing modifier will need to be altered or added to the controlling side to update the back pointers.
See Also: