| With the increasing complexity of computer software,a large number of legacy software with complex structure has been showed up.It is important for developers and maintainers to understand the architecture and specification of software system.Under this circumstance,study of software architecture is becoming more and more urgent in software engineering.It is also recognized that in-depth study and understanding of software code structure will be one of the most effective approach to solve series of problems such as software productivity improvement and maintenance.By extracting relevant components from complex large-scale of legacy software systems,the recovery of software code structure can be an efficient way for people to understand and maintain software system.As an important technology in reverse engineering,program slicing can describe the system from a higher level of abstraction by analyzing the source code,extracting the main part and hiding the details of the system.Related technology in program slicing decomposes software system to get a subset of the origin system by generating slice criteria according to different concerns and run the slice algorithm,which can be helpful to understand the large-scale or legacy software system.Accordingly,program slicing is a very suitable way to achieve code structure recovery.Program slicing based on object-oriented context in Java is studied and practiced in this thesis.An improved method of analyzing dependence and constructing System Dependence Graph(the SDG)based on object expansion is proposed.This method gets the necessary information by parsing source code,recognize and expand object in the source code when necessarily.Based on that,the data dependency can be refined between related nodes.In addition,the method provide the presentation of some new Java features in JDK1.7 as to improve the adaptability of SDG and help to get more accurate slice result.In order to get better recovery result,the minimum slice set which can cover the specific module methods is generated to express the code structure of the corresponding module.A hierarchical clustering method based on calculating of clustering cost is also proposed,which can optimize the final clustering results and help to get a better the result view of code structure recovery.Experiments in open-source projects show that the improved method of constructing SDG can get smaller and more accurate slices,it can also adapt to large-scale Java programs.Meanwhile,the result of code structure recovery based on program slicing shows that we can achieve clusters with some key point methods and recovery the design view,which can be very helpful for developers or maintainers to understandand maintain software system. |