• No results found

Aspect Oriented Programming Benificial for Testing

N/A
N/A
Protected

Academic year: 2020

Share "Aspect Oriented Programming Benificial for Testing"

Copied!
7
0
0

Loading.... (view fulltext now)

Full text

(1)

Aspect Oriented Programming Benificial for

Testing

Raj Kumar *, Susheela Hooda **

*Department of Computer Science & Engineering, B. S. Anangpuria Institute of Technology and Management,

Faridabad (M.D. University, Haryana, India).

**Department of Computer Science & Engineering, B. S. Anangpuria Institute of Technology and Management,

Faridabad (M.D. University, Haryana, India).

ABSTRACT: Aspect Oriented Programming (AOP) is a paradigm of software engineering that offers a new technique

to improve the separation of cross-cutting concerns. It leads to new construct like advice, point cut, joinpoint and aspect supports to the principles of separation of concern. The basic idea of aspect oriented programming is to modularize the cross-cutting concern of a project that helps to enhance the flexibility, code-reusability and decreasing the complexity. Aspect Oriented Programming (AOP) provides a better support for testing to eliminate the errors.

Aspect Oriented Programming (AOP) was introduced in 1996 at Xerox Polo Alto Research Centre (PARC). Gregor Kiczales and his team also developed most popular general-purpose AOP language, AspectJ. Now a days, aspect oriented programming have been developed as a powerful tool for IT industry like software development and testing department.

KEYWORDS: Object Oriented Programming (OOP), Aspect Oriented Programming (AOP), Cross-cutting concerns,

Testing

I. INTRODUCTION

In earlier days, in programming field there were only a few techniques for developing software. But with the passage of time need was felt for different techniques to manage the complexity of projects. In order to meet the requirement of time development in programming was made by adopting techniques for developing software.

Prime facie to manage the complexity in programming of growing of software the need of structured programming was felt for which efforts were made which lead to a programming concept. It is called Structured Programming. It provides a better organization of a structured programming by decomposing the project into small units (module) that are manageable and each module have its own class structure and finally recombining them into a structured way to achieve desired goal. Although some time it creates some problem like code reusability. Programmer found some portion of a code reuse again and again in others module that lead to wastage of memory.

To solve the problem of code reusability a new paradigm that is called Object Oriented Programming (OOP) was introduced. Object Oriented Programming is based on the object that solves the problem of code reusability. It provides a new way for abstraction and modularization. Here, modularity introduced along with the structured programming, provided the programmer with interface to the function units of programs. Even people other than the original programmer could reuse these units multiple times without modification.

(2)

original code but it has also a problem of cross-cutting concerns that support the code tangling and code scattered problem which obstruct the programmer’s productivity.

In order to address the problem of cross-cutting concerns, a new paradigm that is called Aspect Oriented Programming

(AOP) was introduced.

II. ASPECT ORIENTED PROGRAMMING (AOP)

Aspect Oriented Programming solves the problem of cross-cutting concern. It provides the facilities in which we can add new feature in the existing code without changing the original code of a project. It modularized the cross-cutting concern into a separate manageable module and that module is called an aspect.

 An aspect holds all the information (operations and data) that a crosscutting concern uses/manipulates.

 Aspects are concerns that are cross cutting the system’s functionality. They can’t be encapsulated in a single class.

 A new modularity mechanism with which crosscutting concerns can be expressed.

(3)

III. TERMINOLOGY

To understand the concept of aspect oriented programming, defines different terms and their meanings.

Figure (B): Terminology diagram of Aspect Oriented Programming

A. Aspect- aspects are the separate module which is similar like a class that contains the advice and set of point

cuts.

B. Advice- these are the piece of code that is used to take some action at join point and contain all the functionality

of cross-cutting concern.

C. Pointcut- defines a way in which advice bind with the join points.

D. Joinpoint- joinpoint are the place where attached the cross-cutting concern and also specified the flow of

execution.

E. Weaving- it is a process that combined the aspect with the source code. It performed at different time load time,

compile time, and run time.

F. Introduction- it is also known as an inter-type declaration that allows you to attach the new methods, fields and

interfaces.

IV. AOP SOLVE THE PROBLEM OF CROSS-CUTTING CONCERNS

(4)

Figure (C): Banking system without aspect program Figure (D): Banking system with aspect program

For example- In above figure (C): banking system contains three services Account services, ATM services and other services. It also includes two cross-cutting concerns authorization and transaction. These two concerns authorization and transaction spread between the three services. It is difficult to manage these services due to scattered code. Aspect Oriented Programming solves this type of problem to bind a concern in well defined module. Here figure (D), shows an extra aspect program, which contained two aspects i.e. authorization aspect and transaction aspect. From the banking system the authorization and transaction are kept beneath the banking system. All the codes found in one place when these aspects required for execution then these services viz account services, ATM services and other services will fetch the authorization and transaction of aspect program in banking system.

V. RELATED WORK

Gregor Kiczales et.al. [15] published the concept of Aspect Oriented programming. Based on the analysis, they found that AOP solved the problem of cross-cutting concerns. AOP supports clean abstraction and composition. A special processor called an Aspect weaver is used to combine the source code with the aspect. It also defined an AOP framework that helps us to design a system.

Jyri Laukkanen [2] published a research on Aspect Oriented Programming in 2008. In this paper, add the caching functionality without making any modifications to the original source code. This is achieved by using runtime weaving. With the caching functionality it avoided the unwanted and unnecessary code and found a better solution. Author also presented a layered architecture based service utilizing database through a caching aspect.

(5)

reusability and make it easier to validate the design. The framework approach is able to address a large number of aspects. In that framework, introduction of a new aspect must be accompanied by a set of rules that will ensure the integrity of the semantics of the system. These rules are expressed as pre-conditions, post conditions, and the order of activation of aspects.

Daniela Gotseva et.al. [19] presented a paper on Aspect-oriented programming with AspectJ in September 2012. This paper defined the importance of AspectJ. It provides a framework in three step process.

Swati Parashar[3] is an author that published a paper on limitations of aspect oriented programming in IT industry in Oct 2014 proposed architecture of AOP on Enterprise. She defined three factors-Social and Psychological factors, Technical factors and Economic factors.

M. N Qamar et.al. [1] introduced a research in progress for testing of aspect oriented software. They presented a testing framework Aspect Driven Regression Testing Framework (ADRT) for aspect oriented programs, which include the analysis of aspects interaction with a core system. In this frame work, they identified the test cases, test data, automation aspect and addressing the faults which occurs during the Aspect Oriented programs.

Yuewei Zhou et.al. [9] described an approach towards a comprehensive methodology that can effectively test aspects. They defined testing coverage in a way that specifies how an aspect is tested by a set of test cases. To reduce the cost of testing aspects developed a tool that calculates the test coverage for the aspects under test.

Jianjun Zhao[18] mentioned a work on control flow graph for Aspect Oriented Programs. These control flow graph help to generate an idea of data flow for a testing purpose. In this paper, author described the control flow graph for separate aspect oriented programs as well as whole system that contain aspect programs and base programs.

VI. ANALYSIS: AOP SUPPORTS THE TESTING PROCESS

Different authors highlighted the importance of Aspect Oriented Programming with different view. Some author defined the problem with a solution of AOP and others have prescribed this work in a slightly different mode. ADART framework helped to the tester for generating a test cases and find out the errors with regression testing technique.

The study reveals that various authors have defined that Control flow graph (CFG) is a basic need for a testing of programs, with the help of CFG we can find out the Cyclomatic complexity. This cyclomatic complexity used by different type of testing like white box testing to the problem.

Testing is an art to find out the error and make a project error free. Aspect Oriented Programming (AOP) provides a better support for testing. As we know Aspect Oriented Programming defines a separate program for cross-cutting concern and helps us for better understanding. As a tester, we can create test cases for aspect programs separately. We can apply different types of testing like black box testing, white box testing and regression testing to achieve a better goal. A separate testing process provides a better organization for an aspect to reduce the complexity so that it becomes easy to maintain.

(6)

Figure (E): Testing framework for Aspect Oriented Programming

In above figure (E): A general test suits repository contains two different test cases, one is for aspect program and another for source code. Both the test cases table placed in test case repository. A compiler fetch the table and executes the test cases which placed in general test case repository and generate the output by using different techniques of testing.

If we perform the testing of a base program with the aspect program, then it is more difficult to generate the control flow graph for a complete program due to their dependencies. So to overcome this problem we can generate the control flow graph separately to reduce the complexity and dependencies.

VII. BENEFITS OF AOP

1. AOP Manage the cross-cutting concerns for a testing purpose 2. Reduces the duplicated code

3. Decreases the errors and bug 4. Decreases the complexity 5. Easy to maintain

6. Add new functionality without modifying the existing code 7. Solve the problem of code reusability

8. For security purpose, defines the proxies

VIII. DRAWBACKS OF AOP

(7)

IX. CONCLUSION

Aspect Oriented Programming (AOP) provides a powerful tool to manage the cross-cutting concerns. It overcomes the drawback of object-oriented programming by using the modularization. It separates the aspect program and other modules by which we can easily maintain the projects. Aspect oriented programming also supports the testing process. As we know we can build different test cases for an Aspects programs to make an error free. Different approaches give different techniques like Aspect Driven Regression Testing Framework (ADRT) for aspect oriented programs to test the different test case. From a testing, we can develop an AOP bug free by which AOP performs very well.

REFERENCES

1. M. N Qamar, A. Nadeem and R. Aziz- An approach to test aspect-oriented programs july2-2007 2. Jyri Laukkanen- aspect oriented programming 2008

3. Swati Parashar-limitations of aspect oriented programming in industry at best journals in oct. 2014

4. Meng Wang and Bruno C.d.S. Oliveira, Oxford university-what does aspect-oriented programming mean for functional programmers?, august 2009

5. Naresh Chauhan - book of software testing

6. T.J. Highley, Michael Lack, Perry Myers-aspect oriented programming

7. Aspect Oriented Programming by Jurriaan Hage Contributions by Alesya Sheremet (AOP) and Arie Middelkoop (AspectJ). Department of Information and Computing Sciences, October 13, 2010

8. Atef Bader1, Tzilla H. Elrad1, Mohamed E. Fayad2, P.Netinant1 1 Concurrent Programming Research Group Department of Computer Science Illinois Institute of Technology {conscon, elrad, netipan} @charlie.cns.iit.edu [email protected] Designing an Aspect-Oriented Framework in an Object-Oriented Environment

9. Yuewei Zhou, Hadar Ziv, Debra Richardson published a research “Towards A Practical Approach to Test Aspect-Oriented Software”. 10. Y. Hollander, M. Morley and A. Noy, "The Language: A Fresh Separation of Concerns", TOOLS Europe, 2001

11. Davi Robinson- An Introduction to Aspect Oriented Programming Daniela Gotseva1 and Mario Pavlov2 Computer Systems Department, Technical University of Sofia , Bulgaria Aspect-oriented programming with AspectJ, September 2012.

12. Lodewijk Bergmans1 and Cristina Videira Lopes2 (Editors)University of Twente, The Netherlands-aspect oriented programming.

13. JOURNAL OF OBJECT TECHNOLOGY Online at www.jot.fm. Published by ETH Zurich, Chair of Software Engineering ©JOT, 2003 Vol. 2, No. 4, July-August 2003

14. Reza Meimandi Parizi, Abdul Azim Abdul Ghani- AJcFgraph - AspectJ Control Flow Graph Builder for Aspect-Oriented Software-2008 15. Gregor Kiczales, John Lamping, Anurag Mendhekar, Chris Maeda, Cristina Videria Lopes, Jean-Marc Loningtier, John Irwin published the

concept of Aspect Oriented programming in June 1997.

16. Roberta Coellio - drawback of aspect Oriented Programs related to exception handling in 2010.

17. Kotrappa Sirbi, Prakash Jayanth Kulkarni published a research on Stronger Enforcement of Security Using AOP & Spring AOP in 2010. 18. Jianjun zhao-school of software and department of computer science and engineering shanghai Jiao Tong University-control flow graph and

represented for aspect-oriented programs.

19. Daniela Gotseva and Mario Pavlov2 presented a paper on Aspect-oriented programming with AspectJ in September

Figure

Figure (A): Process of Aspect Oriented Programming
Figure (B): Terminology diagram of Aspect Oriented Programming
Figure (C): Banking system without aspect program                Figure (D): Banking system with aspect program

References

Related documents