We describe a manipulable program visualization---the {\it star diagram}---that supports the restructuring task of encapsulating a global data structure. The star diagram graphically displays information pertinent to encapsulation; direct manipulation of the diagram causes the underlying program to be restructured. The visualization compactly presents all statements in the program that use the given global data structure, helping the programmer to choose the functions that completely encapsulate it. Additionally, the visualization elides code unrelated to the data structure and to the task, and collapses similar expressions to allow the programmer to identify frequently occurring code fragments and manipulate them together. The visualization is mapped directly to the program text, so manipulation of the visualization also restructures the program.
We present the concept of the star diagram, and describe an implementation of the star diagram upon a meaning-preserving restructuring tool for Scheme. We also create star diagram generators for C programs, and test the scalability of the star diagram for large commercial C programs. Finally, we evaluate the star diagram's ability to assist data encapsulation by observing programmers performing encapsulation using either standard UNIX tools or the star diagram.