22-10-2012, 04:16 PM
JOURNAL OF OBJECT TECHNOLOGY
article5.pdf (Size: 740.37 KB / Downloads: 23)
Abstract
Aspect-Oriented Software Development is a promising new software engineering paradigm. It promotes, in particular, improved separation of crosscutting concerns into single units called aspects. AspectJ, the most used aspect-oriented programming language, represents an extension of Java. In fact, existing object-oriented programming languages suffer from a serious limitation in modularizing adequately crosscutting concerns. Many concerns crosscut several classes in an object-oriented system. Moreover, several metrics have been proposed in order to assess object-oriented software quality attributes. However, these metrics do not cover the new abstractions and complexity dimensions introduced by the aspect paradigm. As a consequence, new metrics must be developed to assess aspect-oriented systems quality attributes. Cohesion is considered as one of the most important software quality attributes. Cohesion refers to the degree of relatedness between members of a software component. We propose, in this paper, a new approach for aspect cohesion measurement based on dependencies analysis. We introduce several cohesion criteria taking into account aspects' features and capturing various dependencies between their members. We also propose a new aspect cohesion metric and compare it, using several case studies, to few existing aspect cohesion metrics.
INTRODUCTION
Aspect-Oriented Software Development (AOSD) is a promising new software engineering paradigm [Sabb04]. AspectJ, as an aspect-oriented programming language, represents an interesting extension of Java [Kicz01]. In fact, existing object-oriented programming languages suffer from a serious limitation in modularizing adequately crosscutting concerns [Kicz97, Kicz01]. Many concerns crosscut several classes in an object-oriented system. Crosscutting is a structure that goes beyond hierarchy as stated in [Kicz04]. The code related to a crosscutting concern is generally duplicated within several classes in an object-oriented system. Consequently, these classes would be difficult to understand, maintain and reuse. Aspect-Oriented Programming (AOP) deals with scattered and tangled code related to crosscutting concerns. It particularly promotes improved separation of crosscutting concerns into single units called aspects.
Several metrics have been proposed in the literature in order to assess quality attributes (complexity, coupling, cohesion, etc.) in object-oriented systems [Badr95, Badr04, Biem95, Chid94, Hend95, Hend96, Hitz95]. Metrics have become essential
A COHESION MEASURE FOR ASPECTS
98 JOURNAL OF OBJECT TECHNOLOGY VOL. 5. NO. 7
tools in some disciplines of software engineering [Pres01]. However, existing object-oriented metrics are not adequate to capture all the features of aspect-oriented software as mentioned in many papers [Cecc04, Sant03, Zaca03, Zhao03, Zhao04]. AOSD introduces new abstractions and complexity dimensions to software engineering. As a consequence, new metrics taking into account aspects' features must be developed to assess aspect-oriented systems quality attributes.
High cohesion is a desirable property of software components. Cohesion is an underlying goal to continually consider during the design process [Larm04]. It is widely recognized that highly cohesive components tend to have high maintainability and reusability [Biem95, Bria98, Chae00, Li93]. Cohesion refers to the degree of relatedness between component members. Grady Booch describes high functional cohesion as existing when the elements of a component all work together to provide some well-bounded behavior [Booc94]. The cohesion degree of a component is high when it implements a single logical function. It should be difficult to split such a component. Cohesion can be used to identify the poorly designed components. A component with low cohesion may have disparate and non-related members. Such a component has probably been assigned many unrelated responsibilities. Design elements with low cohesion may be considered for restructuring. AOP promotes separating crosscutting concerns and addresses some of these problems. We can expect, for example, cohesion improvement in classes since the code corresponding to crosscutting concerns is implemented in a more modular way. However, we believe that aspect responsibility assignment should also follow these well-tested software engineering principles. An aspect must express a concern (or a part of a concern) in a cohesive manner. Like classes assigned disparate responsibilities, an aspect implementing several and disparate concerns will present a low cohesion. We can expect that such an aspect will be difficult to understand, to test, to reuse and to maintain.
Only few papers addressing aspect cohesion have been published in the literature. We discuss, in the following sections, some aspects' features and particularly the various dependencies that exist between their members. Based on these dependencies, several aspect members' connection criteria will be introduced. These criteria will define our foundations for aspect cohesion and the metric we propose for its assessment. The proposed metric is evaluated using several concrete case studies and compared to the few existing aspect cohesion metrics.
The rest of the paper is structured as follows: Section 2 summarizes the few related works. Section 3 discusses the different dependencies between aspect members. We present, in section 4, several aspect members' connection criteria. Section 5 presents our approach for aspect cohesion and a new metric allowing its measurement. In section 6, several small case studies will be presented illustrating our proposal and comparing it to the other related approaches. Section 7 presents the results of the first experimental study that we conducted in this field. Finally, section 8 gives some conclusions and future work directions.
VOL. 5, NO.7 JOURNAL OF OBJECT TECHNOLOGY 99
RELATED WORK
Presently, few papers addressing aspect-oriented programs quality have been published in the literature [Cecc04, Sant03, Zaca03, Zhao03, Zhao04]. Zhao and Xu's approach [Zhao04] is the first proposal in the field of aspect cohesion measurement. It is based on a dependency model for aspect-oriented software that consists of a group of dependency graphs. According to Zhao and Xu’s approach, cohesion is defined as the degree of relatedness between attributes and modules. Zhao and Xu present, in fact, two ways for measuring aspect cohesion based on inter-attributes (γa), inter-modules (γm) and module-attribute (γma) dependencies. The first way suggests that each measurement (γa,γm,γma) works as a field. Therefore, aspect cohesion for a given aspect A is defined as a 3-tuples Γ(A) = (γa,γm,γma). They also suggest another way for cohesion measurement where each facet could be integrated as a whole with β parameters. Aspect cohesion is then expressed as: