Software Visualization in Prolog
Total Page:16
File Type:pdf, Size:1020Kb
Software Visualization in Prolog Calum A. McK. Grant Queens’ College, Cambridge Dissertation submitted for the degree of Doctor of Philosphy December 1999 Copyright c Calum Grant 1999. Vmax and SVT are copyright c Calum Grant 1999. All rights reserved. Permission is hereby granted to distribute this document without modifica- tion in any format or electronic storage system. Declaration This dissertation is the result of my own work and includes nothing which is the outcome of work done in collaboration. I hereby declare that my dissertation/thesis entitled Software Visualization in Prolog is not substantially the same as any that I have submitted for a degree or diploma or other qualification at any other University. I further state that no part of my dissertation/thesis has already been or is being concurrently submitted for any such degree, diploma or other qualification. This dissertation is approximately 44 000 words long, excluding appendices. Acknowledgments Thanks to everyone who has helped me complete this work, and in particular Peter Robinson my supervisor, the EPSRC for funding this work, the proof-readers, and all members of the Rainbow Group for their help and ideas. Thanks also to the departmental secretaries and to my parents. Trademarks AVS Express is a registered trademark of Advanced Visual Systems, Inc. Borland is a registered trademark of Inprise Corp. C++ Builder is a trademark of Inprise Corp. Delphi is a trademark of Inprise Corp. Genitor is a registered trademark of Genitor Corp. IBM Visualization Data Explorer is a trademark of International Business Machines, Inc. Java is a trademark of Sun Microsystems, Inc. LabVIEW is a trademark of National Instruments, Corp. Linux is a registered trademark of Linus Torvalds. Microsoft is a registered trademark of Microsoft Corp. Motif is a trademark of Open Software Foundation, Inc. OpenGL is a registered trademark of Silicon Graphics, Inc. Open Inventor is a trademark of Silicon Graphics, Inc. Pentium is a trademark of Intel Corp. Prograph is a trademark of Pictorius International. UNIX is a trademark of X/Open Company, Ltd. Visual Basic is a trademark of Microsoft Corp. Visual FoxPro is a trademark of Microsoft Corp. Visual Studio is a trademark of Microsoft Corp. Windows is a trademark of Microsoft Corp. X Window System is a trademark of Massachusetts Institute of Technology. All other trademarks are the properties of their respective owners. 2 Software Visualization in Prolog Calum A. McK. Grant Abstract Software visualization (SV) uses computer graphics to communicate the structure and behaviour of complex software and algorithms. One of the important issues in this field is how to specify SV, because existing systems are very cumbersome to specify and implement, which limits their effectiveness and hinders SV from being integrated into professional software development tools. In this dissertation the visualization process is decomposed into a series of formal mappings, which provides a formal foundation, and allows separate aspects of visu- alization to be specified independently. The first mapping specifies the information content of each view. The second mapping specifies a graphical representation of the information, and a third mapping specifies the graphical components that make up the graphical representation. By combining different mappings, completely dif- ferent views can be generated. The approach has been implemented in Prolog to provide a very high level speci- fication language for information visualization, and a knowledge engineering envi- ronment that allows data queries to tailor the information in a view. The output is generated by a graphical constraint solver that assembles the graphical components into a scene. This system provides a framework for SV called Vmax. Source code and run-time data are analyzed by Prolog to provide access to information about the program structure and run-time data for a wide range of highly interconnected browsable views. Different views and means of visualization can be selected from menus. An automatic legend describes each view, and can be interactively modified to cus- tomize how data is presented. A text window for editing source code is synchronized with the graphical view. Vmax is a complete Java development environment and end user SV system. Vmax compares favourably to existing SV systems in many taxonometric criteria, including automation, scope, information content, graphical output form, specifica- tion, tailorability, navigation, granularity and elision control. The performance and scalability of the new approach is very reasonable. We conclude that Prolog provides a formal and high level specification language that is suitable for specifying all aspects of a SV system. 3 4 Contents 1 Introduction 11 1.1 Aims . ....................................... 12 1.2 Work Done . ................................... 13 1.3 Results . ....................................... 14 1.4 Contribution . ................................... 14 1.5 Notation and Typography . ............................ 16 1.6 Dissertation Overview . ............................ 16 2 Previous Work 17 2.1 Basic Definitions . ............................ 17 2.2 Benefits of Software Visualization . ........................ 18 2.3 Taxonomies of Software Visualization . .................... 19 2.4 Software Visualization Systems . ........................ 22 2.4.1 Development Tools . ............................ 22 2.4.2 Visual Programming Systems . .................... 25 2.4.3 Code Visualization Systems ........................ 25 2.4.4 Algorithm Animation Systems . .................... 27 2.4.5 Run-time Visualization Systems . .................... 31 2.4.6 Architectures . ............................ 32 2.5 Specification . ................................... 33 2.5.1 Visual Language Theory . ........................ 33 2.5.2 Numerical Data . ............................ 34 2.5.3 Specification Languages for SV . .................... 34 2.6 Information Visualization . ............................ 34 2.6.1 Perception . ............................ 35 2.6.2 Representations . ............................ 35 2.6.3 Architectures . ............................ 36 2.6.4 Graphical Layout . ............................ 36 2.7 Research Directions . ............................ 36 2.8 Conclusions . ................................... 37 3 A Model of Information Visualization 39 3.1 Introduction . ................................... 39 3.2 Representing Data . ............................ 41 3.3 Specifying View Content . ............................ 42 3.4 Specifying Visual Content . ............................ 44 3.5 A Visual Type System . ............................ 46 5 6 CONTENTS 3.6 Specifying Graphical Constraints . ..................... 48 3.7 Generating Views . ................................ 49 3.8 Specifying Interaction ................................ 50 3.8.1 Actions . ................................ 50 3.8.2 Reactions . ................................ 51 3.9 Chapter Summary . ................................ 52 4 Semantic Visualization Tool 53 4.1 Introduction . .................................... 53 4.2 Architecture . .................................... 54 4.3 Running SVT .................................... 54 4.4 View Manipulation . ................................ 55 4.5 Generating Visualizations . ............................ 56 4.5.1 Acquiring the Visual Primitives . ..................... 57 4.5.2 Generating the Scene Graph . ..................... 58 4.5.3 Structuring The Scene Graph . ..................... 58 4.5.4 Graphical Layout . ............................ 60 4.5.5 Graphical Layout Algorithms . ..................... 60 4.6 Expanding the Graphical Vocabulary . ..................... 62 4.6.1 Specifying Visual Objects . ..................... 64 4.7 Interaction . .................................... 69 4.7.1 Disambiguating Actions . ..................... 70 4.7.2 Menus .................................... 71 4.7.3 Navigation . ................................ 71 4.7.4 Selecting Graphical Form . ..................... 72 4.7.5 Modifying the Action Relation . ..................... 73 4.8 The Legend . .................................... 75 4.8.1 Displaying the Legend . ..................... 76 4.8.2 Modifying the Visualization Relation . ................. 76 4.9 The Bookmarks . ................................ 77 4.10 The Preview Window ................................ 77 4.11 Chapter Summary . ................................ 79 5 A Tool for Software Visualization 81 5.1 Introduction . .................................... 81 5.2 Architecture . .................................... 82 5.3 Text Processing . ................................ 82 5.4 Directory Visualization . ............................ 84 5.4.1 MIME Types ................................ 88 5.5 Analyzing Java Source Code ............................ 88 5.5.1 Constructing the Program Database . ................. 88 5.5.2 Analyzing the Program Database . ..................... 90 5.6 Java Visualization . ................................ 91 5.6.1 Visualizing Files, Classes and Packages . ................. 91 5.6.2 Visualizing Cross-references . ..................... 99 5.6.3 Visualizing Methods ............................104 CONTENTS 7 5.7 Analyzing Run-time Data . ............................113 5.7.1 Adding Trace Points ............................113 5.7.2 Generating the Trace File . ........................113 5.7.3 Reading the Trace File . ........................115 5.8