I have found the following rules make reuse easier:
- Contained objects should not be aware of the container.
- Containers should be aware of the contents.
- Event handlers should be used for communication from the contained to the container.
- Inter object event handlers should be established by the Container and should be explicitly set up in code.
These simple rules permit reuse of the contained control. Objects developed along these lines are much easier to extend and reuse. It also makes it very quick to rearrange the top level container.
These rules also apply recursively so that a container may be contained in an outer container.