Font Size: a A A

Identifying And Encapsulating Crosscutting Concerns In Java Program

Posted on:2006-03-08Degree:MasterType:Thesis
Country:ChinaCandidate:W FanFull Text:PDF
GTID:2168360155453041Subject:Computer software and theory
Abstract/Summary:PDF Full Text Request
Currently, complex software system includes not only core concerns, butalso some system-level concerns. As system supporting parts, thesesystem-level concerns always take on crosscutting features when we codeusing traditional programming technology, so they are also calledcrosscutting concerns. The codes of crosscutting concerns scatter in andtangle with core concern's codes, which makes the understanding andmaintenance of software system become very difficult.Aspect-oriented programming (AOP) defines a programmingunit--Aspect, and provides mechanism for encapsulating crosscuttingconcerns. As a new programming method, AOP and other existingprogramming methods do not exclude each other, moreover, the formerextends the latter. Base on these, transforming existing OO programs into AOprograms will make the structure and modularity of software becomes better.Furthermore, maintainability and evolvability can be greatly enhanced. Theresearch on how to transform existing OO programs into AO programs willinclude the following work: ⑴Mining crosscutting concern in OO programs.⑵Encapsulating crosscutting codes in Aspect. Our work is mainly about howto transform Java programs into AspectJ programs.Nowadays, there are some technologies for identifying crosscuttingconcerns. The method based on character and type matching can findcrosscutting concern's codes in a great measure, but the result is short ofstructure and the form is too disordered, so it will enhance the difficulty ofencapsulation. The method based on structural program model completelydepends on the relation between different vertices. Because the granularity ofvertex can't get to statement, the search work will greatly rely on the user.In this thesis, the search method is based on Type-relation diagram.Firstly, we give a definition of the Type-relation diagram. It is a directionalone. The vertices are the interfaces and classes in program. The edges are therelation between different vertices, which include imp, extend and reference.Secondly, we analyze the possible programming style of OO program, andexplain that our method focuses on the resolving of better-structural OOprogram. For that is bad, we suggest refactoring it first. Finally, we illustratethe concrete method. In each search process, according to the clueinformation we need to get the vertices for entry first. Then, regard each entrynode as a root and set up a searching branch. In each searching branch, forvery node that has son-nodes, its son-nodes are selected according to therelationship in the type-relation diagram Every time the son-node is found;the searching work for the concrete statements will be performed. Delete thenodes that do not have crosscutting codes, and store the other ones indatabase. In this course, the higher-level structure is formed according totype-relation diagram, and the idiographic statement is found throughcharacter and type matching. Moreover, the assistant tool CCST hasimplemented the automated mining goal. The encapsulation part mainly deals with farther category of theidentified crosscutting codes, and gives the methods on how to encapsulatethem into the corresponding sub-structure of Aspect. The Aspect in AspectJprogramming language includes five sub-structures: ⑴package importdeclarations ⑵Aspect declaration ⑶inter-type member declarations⑷pointcut definitions ⑸advice declarations and definitions. Theencapsulation course includes the following steps: ⑴Declare an emptyAspect ⑵Transform object declarations and method declarations in thesearching result into inter-type member declarations. ⑶Sort and encapsulatethe method-call statements into atomic advises. ⑷Define an appropriatepointcut designator for each atomic advice. ⑸Clear up Aspect. Through theabove steps, we can complete a simple encapsulation of crosscutting concerncodes, and assure that the defined Aspect will be right weaved into the source...
Keywords/Search Tags:Encapsulating
PDF Full Text Request
Related items