Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 232 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
232
Dung lượng
1,12 MB
Nội dung
Static and DynamicReverse Engineering
Techniques forJavaSoftware Systems
Acta Electronica Universitatis Tamperensis 30
TARJA SYSTÄ
Static and DynamicReverse Engineering
Techniques forJavaSoftware Systems
University of Tampere
Tampere 2000
ACADEMIC DISSERTATION
University of Tampere, Department of Computer and Information Sciences
Finland
Acta Electronica Universitatis Tamperensis 30
ISBN 951-44-4811-1
ISSN 1456-954X
http://acta.uta.fi
TARJA SYSTÄ
ACADEMIC DISSERTATION
To be presented, with the permission of
the Faculty of Economics and Administration
of the University of Tampere, for public discussion
in the Paavo Koli Auditorium of the University,
Kehruukoulunkatu 1, Tampere, on May 8th, 2000 at 12 o’clock.
Static and DynamicReverse Engineering
Techniques forJavaSoftware Systems
University of Tampere
Tampere 2000
Acknowledgements
I am very grateful to my supervisor Kai Koskimies for all his support. Over the years, Kai has
encouraged me through my Licentiate and PhD studies. He has given me a lot of feedback and
many useful pieces of advice, every time I needed them. I would also like to thank Erkki M
¨
akinen
for proofreading my papers, encouraging and guiding me in my studies, and being always able to
find answers for all kinds of questions. Kai hired me in 1993 as a researcher for the SCED research
project for almost three years. It was a pleasure and privilege to work with Jyrki Tuomi and Tatu
M
¨
annist
¨
o on SCED. The SCED project was financially supported by the Center for Technological
Development in Finland (TEKES), Nokia Research Center, Valmet Automation, Stonesoft, Kone,
and Prosa Software.
After the SCED project, my PhD studies have been financially supported by Tampere Graduate
School in Information Science and Engineering (TISE). The funding I received from TISE allowed
me to fully concentrate on my PhD studies and to visit the University of Victoria, Canada, during
years 1997-1998. The visit was partly funded by the Academy of Finland. I am grateful to Hausi
M
¨
uller for welcoming me to the Rigi research project at UVic. He gave me a good opportunity to
continue my studies, and made it easy and pleasant for me to work and collaborate with the Rigi
members. I enjoyed those one and half years I was able to spend in Victoria.
I would like to express my gratitude to the reviewers of the dissertation, Hausi M
¨
uller and Jukka
Paakki. Their feedback was useful for improving the work. I would also like to thank Gail Murphy
for many useful comments.
I have been working in the Department of Computer Science, University of Tampere, over six
years. Thanks to the supportive staff members of the department, working during those years has
been so much fun. Special thanks to Teppo Kuusisto, Tuula Moisio, and Marja Liisa Nurmi for all
their help.
Contents
1 Introduction 1
2 Reverseengineering 5
2.1 Extracting and viewing information 6
2.1.1 A single view 7
2.1.2 A set of different views . . . 9
2.2 Reverseengineering approaches and tools 12
2.2.1 Understanding the software through high-level models 13
2.2.2 Software metrics 17
2.2.3 Supporting re-engineering and round-trip-engineering 19
2.2.4 Other tools facilitating reverseengineering 21
2.2.5 Summary 22
3 Modeling with UML 23
3.1 Class diagrams 25
3.2 Sequence diagrams 27
3.3 Collaboration diagrams 27
3.4 Statechart diagrams 29
3.5 Activity diagrams 35
4 SCED 37
4.1 Dynamic modeling using SCED . . 39
4.1.1 Scenario diagrams 39
ii
4.1.2 State diagrams 45
4.2 Examining the models 49
4.3 Summary . 50
5 Automated synthesis of state diagrams 52
5.1 The BK-algorithm 53
5.2 Applying the BK-algorithm to state diagram synthesis 57
5.3 Problems in the synthesis of state diagrams 72
5.4 The speed of the synthesis algorithm 76
5.5 Limitations 77
5.6 Related research 79
5.7 Summary . 82
6 Optimizing synthesized state diagrams using UML notation 83
6.1 Definitions and rules 84
6.2 Packing actions 90
6.3 Transformation patterns 91
6.4 Internal actions 96
6.5 Entry actions 98
6.6 Exit actions 101
6.7 Action expressions of transitions . . 105
6.8 Removing UML notation concepts from state diagrams . . . 106
7 Rigi 110
7.1 Methodology 110
7.2 Rigi views . 112
7.3 Scripting . . 115
7.4 Reverseengineering object-oriented software using Rigi . . 116
7.5 Summary . 118
8 Applying Shimba forreverseengineeringJavasoftware 120
8.1 Overview of the implementation . . 120
8.2 Constructing a static dependency graph 121
8.3 Software metrics used in Shimba . . 124
8.4 Collecting dynamic information . . 126
8.4.1 The event trace 126
8.4.2 The control flow 127
8.5 Managing the explosion of the event trace 140
8.6 Merging dynamic information into a static view 143
8.7 Using static information to guide the generation of dynamic information 143
8.8 Slicing a Rigi view using SCED scenarios 145
8.9 Raising the level of abstraction of SCED scenarios using a high-level Rigi graph . 147
8.10 Related work 150
8.10.1 Dynamicreverseengineering tools 150
8.10.2 Tools that combine static and dynamic information . 153
8.11 Summary . 155
9 A case study: reverseengineering FUJABA software 158
9.1 Tasks . . . 158
9.2 The target Java software: FUJABA . 160
9.3 Dynamic modeling 161
9.3.1 Modeling the internal behavior of a method 161
9.3.2 Modeling the usage of a dialog 168
9.3.3 Structuring scenarios with behavioral patterns 171
9.3.4 Modeling the behavior of a thread object 176
9.3.5 Tracking down a bug 178
9.4 Relationships between static and dynamic models 181
9.4.1 Merging dynamic information into a static view . . . 182
9.4.2 Slicing a Rigi view using SCED scenarios 182
9.4.3 Raising the level of abstraction of SCED scenario diagrams using a high-
level Rigi graph 184
9.5 Discussion . 188
9.5.1 Results of the case study . . 189
9.5.2 Limitations of Shimba . . . 190
9.5.3 Experiences with Shimba . . 191
10 Conclusions 194
10.1 Discussion . 194
10.1.1 Modeling the target software 194
10.1.2 Applying reverseengineering approaches to forward engineering 196
10.1.3 Support for iterative dynamic modeling 198
10.2 Summary of contributions 199
10.3 Directions for future work 202
10.4 Concluding remarks 203
Bibliography 204
Appendices 212
A Rigi domain model for Java: Riginode file 212
B Rigi domain model for Java: Rigiarc file 214
C Rigi domain model for Java: Rigiattr file 217
D Calculating software metrics in Shimba 222
v
Chapter 1
Introduction
The need for maintaining, reusing, and re-engineering existing software systems has increased
dramatically over the past few years. Changed requirements or the need forsoftware migration,
for example, necessitate renovations for business-critical software systems. Reusing and modify-
ing legacy systems are complex and expensive tasks because of the time-consuming process of
program comprehension. Thus, the need forsoftwareengineering methods and tools that facilitate
program understanding is compelling. A variety of reverseengineering tools provide means to
support this task. Reverseengineering aims at analyzing the software and representing it in an ab-
stract form so that it is easier to understand, e.g., forsoftware maintenance, re-engineering, reuse,
and documenting purposes.
To understand existing software systems, both static and dynamic information are useful. Static
information describes the structure of the software as it is written in the source code, while dy-
namic information describes the run-time behavior. Both static and dynamic analysis result in
information about the software artifacts and their relations. The dynamic analysis also produces
sequential event trace information, information about concurrent behavior, code coverage, mem-
ory management, etc.
Program understanding can be supported by producing design models from the target software.
This reverseengineering approach is also useful when constructing software from high-level de-
1
[...]... facilitate, for example, maintenance, reuse, documentation, re -engineering, and forward engineering of the target software Program comprehension can be supported by producing design models from existing software In this dissertation, modeling the static structure of the target software is called static reverse engineering, and modeling its dynamic behavior is called dynamic reverseengineeringReverse engineering. .. illustrate the extracted information: static views, dynamic views, and merged views Static views contain only static information, dynamic views contain only dynamic information, and merged views are used to show both static and dynamic information in a single view Figure 2.1 shows different choices of building views to the target software 2.1.1 A single view Merging dynamic and static information into a single... abstract dynamic views For example, pattern matching algorithms can be used to automatically search for behavioral patterns Furthermore, abstractions are typically constructed for the static views before constructing them for the dynamic views The static hierarchies can then be used for clustering the dynamic information automatically (cf Sections 8.9 and 9.4.3) Most of the static reverse engineering. .. interaction among high level static components instead of showing the interaction between classes or even objects 2.2 Reverseengineering approaches and tools A wide range of reverseengineering and design recovery tools have been developed for both industrial use and academic research Most of them provide better support forstaticreverseengineering than fordynamicreverseengineering Some of the tools... been built to support reverseengineering of Javasoftware systems The static information is extracted from Java byte code [118] It can be viewed and analyzed with the Rigi reverse engineering tool [74] The dynamic event trace information is generated automatically as a result of running the target system under a customized Java Development Kit (JDK) debugger Information about the dynamic control flow... the dynamic information 2.2.3 Supporting re -engineering and round-trip -engineering Chikofsky and Cross characterize re -engineering as an examination of a subject system to reconstitute it in a new form and the subsequent implementation of the new form [18] Reverseengineering approaches are typically used for understanding the subject system in a re -engineering process However, reverseengineering techniques. .. SCED scenario diagram that could characterize the dynamic behavior of the example Java program In forward engineering different diagrams are used to model the static structure and dynamic behavior of the software system For instance, in UML there are static diagrams, dynamic diagrams, and diagrams that model both the static and dynamic aspects of the software From a large set of diagrams, the user chooses... information All reverseengineering environments need tools for extracting the information to be analyzed Static information includes software artifacts and their relations In Java, for example, such artifacts could be classes, interfaces, methods, and variables The relations might include extension relationships between classes or interfaces, calls between methods, and so on The staticreverse engineering. .. and should be applied for forward engineering as well That would support a change from a conventional “water fall” style of forward engineering to a more incremental and evolutionary style of software construction In other words, round-trip -engineering would be supported To support re -engineering and round-trip -engineering 19 2.2 REVERSEENGINEERING APPROACHES AND TOOLS a reverse engineering tool should... round-trip -engineering Hence, state diagrams are used for understanding the behavior of a target Javasoftware system, not for specification of a software system to be implemented Versatile tools and environments that support both forward and reverseengineering are available StP from E2S is a modeling-based software development environment that also supports reverse engineering, testing, and requirements engineering . Static and Dynamic Reverse Engineering Techniques for Java Software Systems Acta Electronica Universitatis Tamperensis 30 TARJA SYSTÄ Static and Dynamic Reverse Engineering Techniques for Java. structure of the target software is called static reverse engineering, and modeling its dynamic behavior is called dynamic reverse engineering. Reverse engineering is difficult for various reasons integration of dynamic and static information aids the performance of reverse engineering tasks. An experimental environment called Shimba has been built to support reverse engineering of Java software