Font Size: a A A

Design Pattern Detection From Java Software

Posted on:2006-09-21Degree:MasterType:Thesis
Country:ChinaCandidate:W J LiFull Text:PDF
GTID:2168360155952976Subject:Computer software and theory
Abstract/Summary:PDF Full Text Request
An important problem demanding prompt solution with today's software maintenance and reengineering is to understand the legacy program with increasing size and complexity. Reverse engineering tools are often used to assist software engineers in software understanding and maintenance, which means using some methods and tools to analysis the software, identify its components and relations between them and create higher level or other style abstraction of it. As a sub area of reverse engineering, the main task of design recovery is to identify design level abstraction of software systems. As a mechanism for expressing object-oriented design experience, design patterns are frequently implemented as building blocks in various software systems. They capture the intent behind a design by identifying objects, their collaborations, and the distribution of responsibilities. Identifying design patterns from source code is helpful for maintainer to understand the design motivation and rationale behind the software system so that it improves software understandability and maintainability of legacy systems that applied design patterns during their developing process. In addition, design patterns supply a design experience library, which can be reused for software development. They act as the micro architecture for constructing the architecture of the whole software system. The recovery of design patterns used in the software system helps to the recovery of the whole software architecture. So identifying design pattern from source code is the basis of software architecture reverse engineering. On the other hand, the application of design patterns always has a close relationship with the quality of software design. The quantity and rationality of patterns application are important criterions of evaluating software design quality. So identifying design patterns from source code is the foundation of software quality evaluation. In addition, because Java is widely used in various software developments, an approach of identifying design patterns from Java source code is provided. In this approach, the task of extracting design patterns from Java code is divided into three subtasks —design patterns description, defining and extracting design information model of source code and searching for design pattern instances through matching two models. Firstly, design patterns referred in this paper are twenty-three general design patterns summarized by Gamma etc. They describe a design pattern from aspects of motivation, intention, participant, collaboration, effect and solution. In order to conveniently understand, choose and implement design patterns, the motivation, intention, participant, collaboration and effect of design patterns are often described informally. Solution part supplies a general design structure expressed by an OMT diagram. However, it is necessary to describe design patterns in a relative formal method and abstract object structure and behavior expressed in design patterns in order to be detected automatically from source code. A design pattern description method is defined in this paper: a design pattern can be represented as a tuple < P, R>, where P denotes the participant set of the design pattern and R denotes the constraint set. Here a participant can be a class, a method or an attribute of a design pattern. According to different participant, it needs to preserve different characters of the participant. Relations between participants include that relations between two class participants (inherit, associate and aggregate), relations between two method participants (invoke, rewrite), relations between a class participant and a method participant (the method creates an instance of the class; the method has an argument of the class type or the method returns a instance of the class), relation between an attribute participant and a class participant (the type of the attribute is the class). Secondly, in order to identify design pattern instances from source code it needs to analyze source code of Java software system, choose and preserve design information of source code related to design pattern detection and construct source information model based on these design information. According to information contained in design pattern description, it can be concluded what information we need to extract from source code. It not only include static structure information such as basic information of class(interface), method, attribute and method argument, relations between class(interface) such as inherit, association and aggregation, but also include behavior information such as invoking relation between methods, rewriting relation between methods and information of method creating class instance etc. We supply extraction method for each piece of above source design information. In Java source code, collection classes are often used to contain other classes, especially abstract classes. It is an effective strategy to accomplish polymorphism and dynamic binding. However, it conceals the true information about the classes that resolved at run-time. Therefore, it prevents the extraction of association and aggregation. It needs to define and identify container class from source code, analyze source code related to container class, find the type of object contained in container class, and then identify more meaningful association relation. This work improves the precision of identifying pattern instances when container classes are implemented in source code such as Mediator, observer.
Keywords/Search Tags:Detection
PDF Full Text Request
Related items