Analyze Aspect-Oriented Software Approach and Its Application
Total Page:16
File Type:pdf, Size:1020Kb
ATHABASCA UNIVERSITY Analyze Aspect-Oriented Software Approach and Its Application By Artur Krupa, Id: 2247378 An essay submitted in partial fulfillment Of the requirements for the degree of MASTER OF SCIENCE in INFORMATION SYSTEMS Athabasca, Alberta June, 2010 ©Artur Krupa, 2010 DEDICATION I would like to dedicate this essay to my wife who supported me throughout. ii ABSTRACT The ultimate goal of software development is to create software systems, usually for a von Neumann architecture of instructions, registers, and memory locations. [7] First computers were created to perform huge number of calculations fast and efficiently. The earliest programming languages were machine oriented languages such as an assembler. The growing power of computers and better operating systems allowed computers to perform more complex tasks such as multitasking and to run complicated applications such as weather simulation software. Initial computer languages were imperative and examples of such language are Algol and FORTRAN. Imperative language has the abstractions of imperative programs such as procedures, statements, and record structures corresponding to a von Neumann architecture. The next step in evolution of programming languages was functional programming, a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data and examples of computer language using functional programming are APL or Lisp. After functional programming, computer languages started to use mathematical logic introducing logic-based programming. The examples of logic-based languages are ALF and Leda. After logic-based programming the Object-oriented Programming was introduced and become very popular. Object-oriented programming is a programming paradigm that uses objects together with their interactions to design applications and computer programs and examples of Object- oriented languages are Java and C++. In order to solve complex problems computer languages should be able to simulate complex systems. This process of evolution of computer languages can be described as moving from a machine oriented view to a problem iii oriented view. The problem oriented view allowed creating programming models with better adaptability, reusability, efficiency, and easy to implement. [7] In 1990s, Object Oriented Programming was a very popular and efficient way of creating computer software. Despite of success of the Object Oriented Programming, it had problems relating to the difficulties with the maintenance of software code. Any change to the code required updates to a large number of unrelated modules. In 1995, a group scientist at the Xerox Palo Alto Research Center (PARC), led by Gregor Kiczales, created a theory for a new paradigm called Aspect-Oriented Programming. The new paradigm was designed to address the Object Oriented Programming problems. The main idea behind the new paradigm is separating crosscutting concerns into single units. During the development process a developer deals separately with crosscutting concerns by implementing aspects. Both code and aspects are combined into an executable form using weaving mechanism. Many scientists consider an Aspect-Oriented Programming as a complement to Object-Oriented Programming by facilitating another type of modularity that pulls together the widespread implementation of a crosscutting concern into a single unit called an aspect. The new paradigm can be implemented in many programming languages, such as Java, C++, Smalltalk, C, and C #. The process of establishing the theory of Aspect- Oriented Programming is still not completed. iv ACKNOWLEDGEMENTS Special thanks and appreciation are owing to the following individuals: Richard Huntrods, my advisor and paper supervisor, for all his generous and clear advices and guidance throughout the preparation of this master‟s essay The always helpful staff and faculty of Athabasca University‟s Master of Science in Information Systems program v TABLE OF CONTENTS CHAPTER I - INTRODUCTION .......................................................................................1 STATEMENT OF PURPOSE ................................................................................... 2 CONTENT ................................................................................................................. 2 SIGNIFICANCE ........................................................................................................ 3 CHAPTER II – THE THEORY BEHIND ASPECT-ORIENTED PROGRAMMING ......5 BACKGROUND ....................................................................................................... 5 BASIC CONCEPTS .................................................................................................. 7 ASPECTUAL DECOMPOSITION AND CROSSCUTTING CONCERNS ......... 11 MODULARITY AND SEPARATION OF CROSSCUTTING CONCERNS ....... 12 WEAVING OR INTEGRATION ............................................................................ 13 CHAPTER III – ASPECT-ORIENTED PROGRAMMING IMPROVEMENTS ............16 SECURITY .............................................................................................................. 16 REAL-TIME CONCERNS ...................................................................................... 19 ERROR AND FAILURE HANDLING................................................................... 22 CHAPTER IV – ASPECT-ORIENTED PROGRAMMING IMPLEMENTATIONS .....25 DEVELOPMENT IN JAVA USING ASPECTJ ..................................................... 25 DEVELOPMENT IN JAVA USING JMANGLER ................................................ 31 DEVELOPMENT IN JAVA USING ASPECT WERKZ ....................................... 37 DEVELOPMENT IN JAVA USING JIAZZI ......................................................... 45 DEVELOPMENT IN .NET AND AOP# ................................................................ 48 IBM IMPLEMENTATION OF ASPECT-ORIENTED PROGRAMMING .......... 56 CHAPTER V – CONCLUSIONS AND RECOMMENDATIONS ..................................65 vi REFERENCES ..................................................................................................................69 APPENDIX A ....................................................................................................................75 APPENDIX B ....................................................................................................................78 APPENDIX C ....................................................................................................................86 APPENDIX D ....................................................................................................................90 APPENDIX E ..................................................................................................................103 APPENDIX F...................................................................................................................110 APPENDIX G ..................................................................................................................115 APPENDIX H ..................................................................................................................122 APPENDIX I ...................................................................................................................125 APPENDIX J ...................................................................................................................131 APPENDIX K ..................................................................................................................136 APPENDIX L ..................................................................................................................142 vii LIST OF TABLES Pages 1. The Extension definition template implementation using AOP ....................................57 2. Examples of AOP examples and RUP equivalents and examples .................................58 3. A sample of hierarchical representation of the RUP meta-model .................................61 4. Examples of terms in which developers think and program ..........................................75 5. Brief summary of comparison of Aspect-Oriented and Container Managed Security ..84 6. Change of C&K metrics measures after implementing AOSim application ...............100 7. Combination of Individual Results for System Properties after implementing AOSim application ........................................................................................................................101 8. Average change over all system properties for real-time concerns after implementing AOSim application...........................................................................................................102 9. Results of measurement of different RPG implementations ........................................108 viii LIST OF FIGURES Pages 1. Implementation of a complex software system as a set of concerns ...............................5 2. Concern identifier prism ..................................................................................................6 3. Aspect-oriented Programming development steps ........................................................10 4. Weaving process ............................................................................................................15 5. AspectJ compilation process ..........................................................................................29 6. A typical AspectJ‟s browser session ..............................................................................30