节点文献

横切关注分离方法研究

Techniques for Separation of Crosscutting Concerns

【作者】 何丽莉

【导师】 金淳兆;

【作者基本信息】 吉林大学 , 计算机软件与理论, 2007, 博士

【摘要】 面向方面的程序设计(AOP)是上世纪90年代后期出现的一种关注分离技术。它基于传统的程序设计方法,并提供了一种新的模块机制“Aspect”,能够封装系统中的“横切关注”,因而受到了业界的广泛关注。AOP的成功和流行引起了一个新的重要问题“如何将现有的软件系统转换成面向方面的系统”。本文围绕这一问题进行研究,主要包括:(1)提出了一种基于概念格的Aspect挖掘方法。(2)提出了一种基于聚类分析和关联规则的Aspect挖掘方法。并针对原有聚类算法在处理庞大对象矩阵需要消耗大量时间的问题,提出了一种改进的层次聚类算法ICHAMELEON。(3)提出了一种基于类关系图的横切关注代码搜索方法。(4)提出了一种基于类关系图的横切关注代码Aspect封装方法。本文的研究结果对于代码级横切关注分离方法在理论和实际应用方面有较大意义。

【Abstract】 One of the most important principles of software engineering is the principle of separation of concerns, which was proposed by Dijkstra in 1976. Dijkstra’s viewpoint is summarized as“deal with one import issue at a time”. The importance of separation of concerns is well known, but there are still some concerns, known as crosscutting concerns, in software system: whose implementation cannot be captured cleanly inside modular units, but crosscuts the existing decomposition of the software, scattering and tangling. In the mid-1990, a new paradigm, Aspect oriented programming, emerged. Aspect-oriented programming offers developers an extra abstraction‘Aspect’to group the code dealing with a crosscutting concern, then the software can be decomposed into cleanly encapsulated modules.The success and popularity of Aspect-oriented programming has raised the important issue of how an already existing software system can be transformed into an Aspect oriented one. The core of the problem is how to identify the crosscutting concerns from the legacy system, extract the code of the concerns and put it into an Aspect. It is a two-stage process: 1. Aspect Mining; 2. Aspect Refactoring. Under this context this paper makes the researches on the bellowing Aspects:Aspect mining or Aspect identification is a reverse engineering process aimed at finding potential Aspect in existing non-aspect oriented code. It can be conducted in two ways, a bottom up approach without knowledge about the system, or a top down approach searching for code that implements some known crosscutting concerns. Usually, up-to-date documentation is often unavailable, and no one could tell what kind of crosscutting concerns are there in the given legacy system. The only thing that could depend on is the source code itself. Reasoning about the source code or about data that is acquired by executing or manipulating the code, searching for symptoms of crosscutting concerns, engineers then may find out the potential Aspects. Code scattering and code tangling are two symptoms which indicate the existence of crosscutting concerns. In OO system, member methods implement the minimal function. Member methods are the targets to be analysized to find out connotative crosscutting concerns. There are two kinds of implementation of crosscutting concerns in well-structured system:“function definition”and“function reference”. The implementation codes of crosscutting concerns of“function definition”are encapsulated in one or more methods, while the implementation codes of“function reference”are the statements that call the methods which implement the function of crosscutting concerns, and related program elements.We propose an Aspect mining approach based on the concept lattice named AMUCO. It is a kind of bottom up Aspect mining approach which applies concept lattice to static direct invocation relationship among member methods of object-oriented systems to characterize code scattering. The assumption behind this approach is that the behavior from the same concern often has a similar mode of invocation. Candidate Aspects are contained in the bottom side of concept lattice. Candidate Aspects are provided by method sets. The method(s) from the same set is (are) the implementation of the same crosscutting concern. Experiment shows that scattered method(s) that implement some crosscutting concerns can be found by AMUCO. For that method, who implements a different side of target concerns without the same naming rules, AMUCO can identify them as a candidate crosscutting concerns.We propose another Aspect mining technique named AMUCA, which use both clustering analysis and association rule mining for Aspect mining. AMUCA has the same assumption and granularity with AMUCO; it discovers Aspects at the level of methods, but use a different mining algorithm, and a different crosscuts identification technique. Candidate Aspects, including advice declaration, pointcuts and advice body, are generated automatically after clustering and association rule mining. Experiment shows the same candidate Aspects can be gotten using AMUCA on the same case.CHAMELEON algorithm is used in the AMUCA approach because it has stronger ability in finding clusters that are of diverse shapes, densities, and sizes. But when dealing with large multidimensional data in the context of Aspect mining, CHAMELEON costs too much time. ICHAMELEON, the improvement of CHAMELEON, is proposed to solve the problem. ICHAMELEON combine historical clustering result with "incremental" data items, which keeps the dynamic clustering characteristic of CHAMELEON and is highly efficient in terms of time complexity. Experimental results on large high-dimensional data sets show the efficiency of ICHAMELEON compared with CHAMELEON.The techniques mentioned above identify program elements which participate in a crosscutting concern based on source code characteristics. The identified elements are sets of member methods. The methods in one set constitute the“function definition”type of implement of crosscutting concerns. The methods are“seeds”for further Aspect mining to find out all of the elements (classes, methods, fields, or statements) that implement target crosscutting concerns, which constitute the“function reference”type of code of crosscutting concerns.We propose a novel approach for searching Aspect code based on class-relation diagram (CRD). It is a top-down Aspect mining technique by using the given“seeds”of target system. A CR diagram is a directed diagram, and it provides a structural representation of legacy system. It can be used to find and document the implementation code of crosscutting concerns. Two kinds of approach and process are detailed in this paper according to the character of implementation code of crosscutting concerns. An Aspect refactoring approach based on class relation diagram is provided to extract the implementation code into Aspect. A five-step encapsulating process is built according to the five sub-structures defined in AspectJ’s Aspect. Two kinds of encapsulating process are used according to the two different types of Aspect searching approach.The whole process for mining the implementation code of crosscutting concern from object-oriented legacy system and refactoring them to Aspect is detailed in this thesis. Both the bottom-up and top-down Aspect mining approaches are used in the mining process, and all elements that implement the crosscutting concerns can be found out. Two approach, AMUCO and AMUCA, are proposed aimed to find out“function definition”type of implement in object-oriented system, but they can be used on the Aspect mining of legacy system written in an imperative language with a few modification, because the similarity defined here are based on the static direct invocation relationship between member methods.The study results of the thesis are of both theoretical and practical benefit to further researches on separation of crosscutting concerns methods, and migration of legacy system to Aspect oriented one.

  • 【网络出版投稿人】 吉林大学
  • 【网络出版年期】2007年 03期
节点文献中: 

本文链接的文献网络图示:

本文的引文网络