Aspect-Oriented Programming, Separation of Concern, Change Operations, Software Evolution, Aspectj

Aspect-Oriented Programming, Separation of Concern, Change Operations, Software Evolution, Aspectj

Software Engineering 2013, 3(2): 5-12 DOI: 10.5923/j.se.20130302.01 Change Operations and Their Consequences in AOP Evolution Sandra Casas *, Cecilia Fuentes Zamorano, Héctor Re inaga Instituto de Tecnología Aplicada, Universidad Nacional de la Patagonia Austral, Río Gallegos, 9400, Argentina Abstract Simple change operations to source code can cause unexpected behavior. In particular, two well-known problematic situations, fragile pointcuts and aspect interactions, pose serious challenges for the evolution of software with aspects. We believe that if developers are informed about the consequences of the change operations they are considering, they will be able to avoid various errors. This work analyzes the effects of change operations in AO applications. It proposes the Identification, Qualitative, and Quantity (IQQ) model as a conceptual approach to anticipating the consequences of change operations, along with BaLaLu, a tool that supports the IQQ model. Ke ywo rds Aspect-oriented Programming, Separation of Concern, Change Operations, Software Evolution, AspectJ consequently, how the overall system will behave. 1. Introduction Moreover, seemingly innocuous and simple changes in the source code may produce erroneous and unintended A crosscutting concern (CCC) is program behavior that behaviors. Since it is easy to lose track of the global cannot be adequately modularized with respect to the other characteristics of how base code and aspects interact, it can parts of a system[1]. AOP provides constructs for be difficult to identify the code that is responsible for such modularizing CCCs[2] in order to decrease code scattering unanticipated behavior. Similar consequences can occur and tangling. AOP proposes a new kind of modularization when a join point is reached by two or more pointcuts and called aspects. An aspect is a module that can localize the the developer is not aware of the situation and therefore implementation of a CCC. AOP adopts a specific does not address it. These two problematic situations, conception of CCCs: a CCC contains functionality that is known as fragile pointcuts[3] and aspect interactions[4], executed at different join points. A join point is a represent a real problem for the evolution of software using well-defined point in a program’s control flow. The main aspects and can directly impact maintenance tasks, time, abstractions of AOP are pointcuts, which are predicates that effort, and costs. describe a set of join points, and advice, comprised of Our proposal aims to answer the question, What will blocks of functionality that can be bound to pointcuts. The happen if a change operation is performed? We believe that key to the AOP modularization technique lies in its if developers are aware of the consequences of future composition mechanism. In traditional approaches such as change operations, they can avoid various errors. The OO, subroutines explicitly invoke the behaviors central software artifact in this study is source code, and for implemented by other subroutines. In contrast, aspects have that reason we have focused on the AspectJ language[5]. an implicit invocation mechanism, so that the behavior of However, our approach may be applied to any other AO an aspect is implicitly invoked in the implementation of language. other modules. Consequently, the implementation of these The rest of this paper is organized as follows. In Section other modules can be largely unaware of the CCC. 2, we analyze the effects of change operations in AO However, this structure (pointcuts and advice) makes it applications. In Section 3, we present the Identification, difficult for developers to evaluate the behavior of a system. Qualitative, and Quantity (IQQ) model as a conceptual In particular, the implicit invocation mechanism introduces approach to anticipating the consequences of change an additional layer of complexity in the construction of a operations. In Section 4, we present the BaLaLu tool, which system. This can make it difficult to understand how and supports the IQQ model, along with some tests. Finally, in when the base system and the aspects interact, and Sections 5 and 6, we discuss related work and present our * Corresponding author: conclusions. scasas@unp a.edu.ar (Sandra Casas ) Published online at http://journal.sapub.org/se Copyright © 2013 Scientific & Academic Publishing. All Rights Reserved 2. AOP Evolution 6 Sandra Casas et al.: Change Operations and Their Consequences in AOP Evolution Aspects are the central abstraction of AOP. Two modular Interaction, conflicts or interferences[4] comprise another components comprise an aspect: pointcuts and advice. issue that may arise during software evolution in complex Advice is a fragment of code, such as a method, that will be systems with several CCCs and aspects. A new pointcut can executed with the base code (after, before, or around). A create one or more conflicts with existing pointcuts. pointcut is an expression that establishes the events and Sometimes conflicts among aspects require specific conditions specifying when and where advice code will be treatment by the developer, such as defining an order of executed, typically as a method call. Pointcuts are the more execution. The problem arises because weavers of the AO critical elements in AOP evolution, because a simple change language do not report when aspects are in conflict, and they in the base code may alter the set of join points of any are simply weaved (composed) as in any other case. If an pointcut and have consequences for advice execution. application developer is not aware of the conflicts among Pointcuts can refer to events either explicitly or by using aspects, the application behavior may be erratic and defined pattern names with wildcards. The tight coupling unpredictable. and dependence between pointcuts and base code are the An elementary change in base code or a pointcut cause of fragile pointcuts and aspect interactions. specification can produce potential false positives/negatives Change operations represent software evolution; they are and interactions. When this happens, developers must the actions that developers carry out when they modify identify the problem and resolve it. However, the source code. Some examples include adding a class, identification of false positives/negatives and interactions renaming a method, and applying a refactoring[6]. Change and their causes is not a trivial task in mediu m-scale operations are important because they can generate diverse applications. This analysis is even more difficult when it is nonlocal consequences in AO applications. After a change performed after the source code has been modified, at which operation has been applied, a pointcut may either capture too point developers must perform several tasks such as many join points (false positives) or fail to capture certain exhaustive code analysis and inspection and intensive join points that were intended to be captured (false execution of test cases. All these tasks impact maintenance negatives). A simple example is presented in the following time and effort, with increasing maintenance costs, and new listing code: methods and tools are necessary to reduce the maintenance public aspect LogChangePosition { time, effort, and costs. pointcut changePositionPoint(Point p): call(* Point.set*(int))&& target(p); after(Point p): changePositionPoint(p) { 3. IQQ Model Logger.writeLog("Change position Point:” The goal of the IQQ model is to provide a model for +p.toString()); } anticipating the consequences of changes in applications pointcut changePositionLine(Line l): with aspects. IQQ does this based on three premises: call(* Line.set*(Point)) && target(l); 1) Identify the consequences of change operations in AO after(Line l): changePositionLine(l) { applications. This implies the possibility of detecting the Logger.writeLog("Change position Line:” effects of change operations on source code. +l.toString()); } 2) Quantify the consequences of change operations in } metrics that facilitate the analysis for developers. This The LogChangePosition aspect implements a log implies the possibility of quantitatively measuring false mechanis m to register the position changes of Point and Line positives/negatives and conflicts that a change operation may objects. Table 1 indicates consequences that very simple produce. changes in the domain (Point and Line classes) can have. 3) Qualify the consequences and relate them to the Ta b l e 1 . Change Operations and Consequeces quantified information. This implies the possibility of delimiting the segments of source code that may be affected Change Consequences by a change operation. The intercept ion {call (void Rename type Point as MyPoint Point.set*(int )} is empty and pot ent ial The main components of the IQQ model are a program false negatives result. repository, change operations, and their consequences. Change t he signat ure void {call (void Point .set *(int)} is broken set X(int ) to void set X(double) and potential false negatives result. 3.1. Program Re positor y Add a field to Point and Line LogChangePostit ion aspect will Our approach represents programs as entities rather than classes that is not related to intercept the calls to the new method posit ion, and add a sett ing met hod text files. Since we focus on AO applications, we consider and potential false positives result. for it. constructs such as packages, classes, methods, fields, aspects, pointcuts, advice, and exception handlers. We also represent The problems

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us