Methodology: The AOP Refactoring Process Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton Advisor:

Slides:



Advertisements
Similar presentations
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Advertisements

Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
An Aspect-Oriented Approach For Web Application Access Control Presented by: Mohamed Hassan Carleton University Carleton University
1 JAC : Aspect Oriented Programming in Java An article review by Yuval Nir and Limor Lahiani.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development.
Spring, Hibernate and Web Services 13 th September 2014.
Secure Systems Research Group - FAU Aspect Oriented Programming Carlos Oviedo Secure Systems Research Group.
Copyright © 2008 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are trademarks of Accenture. Andrew Stone Common Security.
Aspect-Oriented Programming In Eclipse ® Aspect-Oriented Programming in Eclipse with AspectJ Dr Helen Hawkins and Sian January.
Enterprise development reference architecture (EDRA) -Deepti Seelamsetti.
ASPECT ORIENTED SOFTWARE DEVELOPMENT Prepared By: Ebru Doğan.
University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales.
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
1 FM Overview of Adaptation. 2 FM RAPIDware: Component-Based Design of Adaptive and Dependable Middleware Project Investigators: Philip McKinley, Kurt.
Spring Roo CS476 Aleksey Bukin Peter Lew. What is Roo? Productivity tool Allows for easy creation of Enterprise Java applications Runs alongside existing.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 18 Slide 1 Software Reuse.
Introduction to the Enterprise Library. Sounds familiar? Writing a component to encapsulate data access Building a component that allows you to log errors.
Software Engineering Muhammad Fahad Khan
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse.
LAYING OUT THE FOUNDATIONS. OUTLINE Analyze the project from a technical point of view Analyze and choose the architecture for your application Decide.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.
ABSTRACT Zirous Inc. is a growing company and they need a new way to track who their employees working on various different projects. To solve the issue.
C++ Code Analysis: an Open Architecture for the Verification of Coding Rules Paolo Tonella ITC-irst, Centro per la Ricerca Scientifica e Tecnologica
Introduction to Aspect Oriented Programming Presented By: Kotaiah Choudary. Ravipati M.Tech IInd Year. School of Info. Tech.
Architecture-Based Runtime Software Evolution Peyman Oreizy, Nenad Medvidovic & Richard N. Taylor.
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
Aspect Oriented Programming Scott Nykl CSSE 411 Senior Seminar.
Extensible Plug-ins for Aspect-Oriented Programming Macneil Shonle*Ankit Shah.
Composing Adaptive Software Authors Philip K. McKinley, Seyed Masoud Sadjadi, Eric P. Kasten, Betty H.C. Cheng Presented by Ana Rodriguez June 21, 2006.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development 1.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton February 28th, 2003 Advisor: David G. Hannay Client:
Aspect Oriented Programming Gülşah KARADUMAN.
On the Modularity Assessment of Aspect- Oriented Multi-Agent Systems Product Lines: a Quantitative Study Camila Nunes
FlexElink Winter presentation 26 February 2002 Flexible linking (and formatting) management software Hector Sanchez Universitat Jaume I Ing. Informatica.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
TRANSPARENT EXTENSION OF SINGLE- USER APPLICATIONS TO MULTI-USER REAL-TIME COLLABORATIVE SYSTEMS An Aspect Oriented Approach to Framework Integration ICEIS.
1 An Aspect-Oriented Implementation Method Sérgio Soares CIn – UFPE Orientador: Paulo Borba.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Introduction to Software Architecture.
AspectJ – AOP for Java Tom Janofsky. Instructor at Penn State Abington Consultant with Chariot Solutions JUG Member.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
1 Contract-based Verification for Aspect-oriented Refactoring Naoyasu Ubayashi(Kyushu Institute of Technology) Jinji Piao(Kyushu Institute of Technology)
Demeter Aspects We study techniques for the emerging area of Aspect-Oriented Software Development and focus on the following areas:  Aspectual Collaborations.
Chapter 8: Aspect Oriented Programming Omar Meqdadi SE 3860 Lecture 8 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Java EE Patterns Dan Bugariu.  What is Java EE ?  What is a Pattern ?
1 ECE 750 Topic 8 Meta-programming languages, systems, and applications Evolving Object-Oriented Designs with Refactorings – Lance Tokuda and Don Batory.
MVC WITH CODEIGNITER Presented By Bhanu Priya.
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
Kansas City Java User’s Group Jason W. Bedell July 12, 2006
问题 Code scattering Blocks of duplicated code Blocks of complementary code, and different modules implementing complementary parts of the concern Code.
aspectj tools new and noteworthy Mik Kersten University of British Columbia Adrian Colyer IBM Hursley OOPSLA, October
AOSD'04, Lancaster, UK 1 Remote Pointcut - A Language Construct for Distributed AOP Muga Nishizawa (Tokyo Tech) Shigeru Chiba (Tokyo Tech) Michiaki Tatsubori.
Aspect-Oriented Software Development (AOSD)
Implementing Distribution and Persistence Aspects with AspectJ WAS CLASS.
PPL 2004, Gamagori, AICHI1 Remote Pointcut - A Language Construct for Distributed AOP Muga Nishizawa (Tokyo Tech, Japan) Shigeru Chiba (Tokyo Tech, Japan)
XML 2002 Annotation Management in an XML CMS A Case Study.
Submitted by: Moran Mishan. Instructed by: Osnat (Ossi) Mokryn, Dr.
PROJECT SECME Carthik A. Sharma Juan Carlos Vivanco Majid Khan Santhosh Kumar Grandai. Software Engineering Fall 2002.
Enterprise Library 3.0 Memi Lavi Solution Architect Microsoft Consulting Services Guy Burstein Senior Consultant Advantech – Microsoft Division.
Software Reuse. Objectives l To explain the benefits of software reuse and some reuse problems l To discuss several different ways to implement software.
Software Engineering Lecture 7
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Demeter Aspects Who We Are Aspectual Collaborations
Lecture 1: Multi-tier Architecture Overview
Software Design Lecture : 14.
Dependency Inversion principle
ARV: Aspect Refactoring Verifier
Refactoring the Aspectizable Interfaces: An Empirical Assessment
Presentation transcript:

Methodology: The AOP Refactoring Process Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton Advisor: David G. Hannay, Union College Client: Robert Berry, IBM Java Technology Centre, Hursley, UK aspectj. Background: aspectj. & AOP AspectJ is a small and well-integrated extension to Java that weaves java byte code and outputs.class files compatible with any JVM. What is Aspect Oriented Programming? Concern – “a specific requirement or consideration that must be addressed in order to satisfy the overall system goal.” AOP is a programming language mechanism that extends Object- Oriented Programming in order to achieve modularity and the ‘separation of concerns’. AOP introduces a new unit of modularization, an aspect, that captures behaviors that affect multiple classes (a crosscutting concern) into reusable modules. What are aspects? Aspects are:  concerns that crosscut[design level]  a programming construct[implementation level] Aspects = pointcut + advice + inter-type declarations Joinpoint: a principle point in the execution of the software system Pointcut: predicate matching on joinpoints (where) Advice: behavior that should be triggered at joinpoints, selected using a pointcut (what) Inter-type Declarations: Fields and methods that the aspect manages on behalf of other types AspectJ’s goal is to support the programmer in cleanly separating components and aspects from each other by providing mechanisms that make it possible to abstract and compose them to produce the overall system Abstract Aspect-oriented programming (AOP) enables developers to develop and manage 'cross-cutting concerns' unrelated to the primary function of the system component. Using AOP, these concerns can then be introduced to the base component easily and in a structured manner. Other benefits of using AOP include the creation of software that is easier to understand and modify. Caching, a common and effective technique to improve the performance of applications and middleware, is such a cross-cutting concern. We explore this by refactoring a complex web application, Apache Cocoon, using AOP to introduce a caching mechanism. The goal is to retain the original external behavior, while removing complexity and adding flexibility in the caching system. The development of the AspectJ language and compiler allows the application of this methodology on the existing base of Java-based web applications without requiring new infrastructure. This project takes the next step by using AspectJ to simplify and extend the caching system in a large and complex XML-based website publishing system; it explores the potential difficulties associated with using AspectJ to accomplish this task and considers the effect that the application architecture has on the aspect-oriented refactoring process. Background: Refactoring Refactoring – a change made to the internal structure of the software to make it easier to understand and cheaper to modify without changing its observable behavior Background: Apache Cocoon A dynamic multi-channel web publishing platform “Apache Cocoon is a web development framework built around the concepts of separation of concerns and component-based web development.” – Cocoon Goal: The separation of content, style, logic and management functions in an XML content based web site (and web services). Usage example: Take data from a database and publish the content onto a web portal in HTML, PDF, and WHTML formats simultaneously. Step 2: Write Caching Aspects privileged public aspect CachingAspect { /* Ascii art generator */ declare parents: org.apache.cocoon.generation.asciiart.AsciiArtSVGGenerator implements CacheableProcessingComponent; public Serializable org.apache.cocoon.generation.asciiart.AsciiArtSVGGenerator.generateKey() { return this.inputSource.getURI(); } public SourceValidity org.apache.cocoon.generation.asciiart.AsciiArtSVGGenerator.generateValidity() { return this.inputSource.getValidity(); }.... ‘Mixin’ it up: Use AOP design patterns to condense reusable code public interface SharedCacher extends CacheableProcessingComponent { public SourceValidity generateValidity(); public java.io.Serializable generateKey(); } public aspect SharedCacherAspect { declare parents: (org.apache.cocoon.serialization.FOPSerializer|| org.apache.cocoon.serialization.iTextSerializer|| org.apache.cocoon.transformation.FragmentExtractorTransformer|| org.apache.cocoon.serialization.SVGSerializer|| org.apache.cocoon.serialization.AbstractTextSerializer ) implements SharedCacher; public Serializable SharedCacher.generateKey() { return "1"; } public SourceValidity SharedCacher.generateValidity() { return NOPValidity.SHARED_INSTANCE; } } Specialized reusable class Classes with same caching behavior Introduce Interface Introduce Methods Analysis & Observations Question: How should you structure your application to simplify AO extendibility?  Good coding practice makes AO adoption easier -Standard variable naming Disparate names: LexicalSource, GrammarSource, etc. needed to be refactored to “InputSource” before they could be used to remove code via AOP.  Standard accessor methods are required to reduce introductions through Mixins. - Example: One case needed getInputSource() -But how are we supposed to know we need these when writing the software? - We can’t know. The lesson: In some cases you need to perform Object-Oriented refactoring in order to allow AOP to reduce code duplication. Open Questions In a component architecture, do we define crosscutting concerns?  Do we examine each block individually or the system as a whole?  What do you do if it is a crosscutting concern in the system but not within the block? This points to a larger problem How should aspects be viewed on a design level? Future Work  Integrate the AspectJ Compiler into the Cocoon build process so that the AO caching solution can be deployed on a Tomcat web server.  Use AOP to refactor the internal object store within Cocoon. This is an ‘internal cache’ where classes can store objects for later retrieval. This is a very closely related to this project since the caching system is just a thin wrapper around this store.  An event-driven ‘inverted’ AOP caching system Build a caching system that uses AOP to handle ‘Avalon’ events and perform the proper cache invalidations. AOP solves the design problem of where to define the caching strategy. Conclusions  Many more opportunities for AOP in Cocoon!  Modifications to the AspectJ language and implementation would make the process easier, but it is still viable today. Summary: Abstracted 39 implementations of CacheableProcessingComponent Used AOP to condense and remove 24 methods from the base implementation. Removed all of the caching code into a single AOP package. Example: Duplicate code: public Serializable org.apache.cocoon.transformation.LexicalTransformer.generateKey() { return this.lexiconSource.getURI(); } public Serializable org.apache.cocoon.transformation.ParserTransformer.generateKey() { return this.grammarSource.getURI(); }  AOP is another tool, it not a ‘silver bullet’ and conventional refactoring methodologies and tools are still necessary. References & Resources  Apache Cocoon Project  AspectJ Project -  Project website –  Thanks to the AspectJ team at Hursley for their valuable assistance and for providing some background information on AOP. Step 1: Identify locations – “Aspect Mining” Used AspectJ to define a compiler warning in order to identify locations in Cocoon that implement the CacheableProcessingComponent abstract interface. public aspect ExploreCaching { declare warning: staticinitialization(org.apache.cocoon.caching.CacheableProcessingComponent+) && !within(org.apache.cocoon.caching..*): "Class implements cacheable"; } Step 3: Remove References and Compile Step 4: Testing & Verification In Progress Integrating AspectJ into Cocoon Ant build process