Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton February 28th, 2003 Advisor: David G. Hannay Client:

Slides:



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

Awais Rashid, Steffen Zschaler
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.
Software Reuse SEII-Lecture 28
Adding scalability to legacy PHP web applications Overview Mario A. Valdez-Ramirez.
Aspect-Oriented Programming In Eclipse ® Aspect-Oriented Programming in Eclipse with AspectJ Dr Helen Hawkins and Sian January.
University of British Columbia Software Practices Lab Fluid AOP Join Point Models Terry Hon Gregor Kiczales.
Enterprise development reference architecture (EDRA) -Deepti Seelamsetti.
University of British Columbia Software Practices Lab 2005 CASCON A Fluid AOP Editor Terry Hon Gregor Kiczales.
Review Amit Shabtay. March 3rd, 2004 Object Oriented Design Course 2 Review What have we done during the course? Where to learn more? What is for the.
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.
Review David Rabinowitz. March 3rd, 2004 Object Oriented Design Course 2 Review What have we done during the course? Which topics we have not discussed?
Generative Programming. Generic vs Generative Generic Programming focuses on representing families of domain concepts Generic Programming focuses on representing.
Understanding and Managing WebSphere V5
1 Model Interface Implementation for Two-Way Obliviousness in Aspect-Oriented Modeling Presented by Wuliang Sun Department of Computer Science Baylor University.
Spring Roo CS476 Aleksey Bukin Peter Lew. What is Roo? Productivity tool Allows for easy creation of Enterprise Java applications Runs alongside existing.
Introduction To System Analysis and design
©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.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
Introduction to Aspect Oriented Programming Presented By: Kotaiah Choudary. Ravipati M.Tech IInd Year. School of Info. Tech.
Aspect Oriented Programming (AOP) in.NET Brent Krueger 12/20/13.
Aspect Oriented Programming Scott Nykl CSSE 411 Senior Seminar.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development 1.
MOTOROLA and the Stylized M Logo are registered in the US Patent & Trademark Office. All other product or service names are the property of their respective.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
Aspect Oriented Programming Gülşah KARADUMAN.
On the Modularity Assessment of Aspect- Oriented Multi-Agent Systems Product Lines: a Quantitative Study Camila Nunes
Generative Programming. Automated Assembly Lines.
introducing the Java Data Processing Framework Paolo Ciccarese, PhD On behalf of the JDPF Team Pavia, December 11, 2007.
Methodology: The AOP Refactoring Process Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton Advisor:
Architectural Patterns Support Lecture. Software Architecture l Architecture is OVERLOADED System architecture Application architecture l Architecture.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
Chapter 8 Object Design Reuse and Patterns. Object Design Object design is the process of adding details to the requirements analysis and making implementation.
METS Dissemination METS Opening Day Corey Keith
Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington
1 An Aspect-Oriented Implementation Method Sérgio Soares CIn – UFPE Orientador: Paulo Borba.
Software Design: Principles, Process, and Concepts Getting Started with Design.
Inter-Type Declarations in AspectJ Awais Rashid Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
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.
Devon M. Simmonds SERP’08, July-14-17, Las Vegas 1 Aspect-oriented Approaches to Model Driven Engineering Devon M. Simmonds Computer Science Department.
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 ?
® IBM Software Group © 2007 IBM Corporation Module 1: Getting Started with Rational Software Architect Essentials of Modeling with IBM Rational Software.
Kansas City Java User’s Group Jason W. Bedell July 12, 2006
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.
Applying Aspect-Orientation in Designing Security Systems Shu Gao Florida International University Center for Advanced Distributed Systems Engineering.
Aspect Security - RaviShekhar Gopalan - Prof. Lieberherr Software Security (CSG379)
2000 Research Overview Dr. Kim Mens Programming Technology Lab Vrije Universiteit Brussel.
Implementing Distribution and Persistence Aspects with AspectJ WAS CLASS.
Plug-In Architecture Pattern. Problem The functionality of a system needs to be extended after the software is shipped The set of possible post-shipment.
L’origine dei mali: le dipendenze tra componenti Stefano Leli 14° Workshop DotNetMarche Venerdì 16 aprile
Inspections on Testing Aspect-Oriented Programs Rodrigo Manuel Lopes de Matos Moreira 4 th Doctoral Symposium on Informatics Engineering Porto, 6 th February.
Aspect-oriented Code Generation Approaches Abid Mehmood & Dayang N. A. Jawawi Department of Software Engineering Faculty of Computer Science and Information.
Enterprise Library 3.0 Memi Lavi Solution Architect Microsoft Consulting Services Guy Burstein Senior Consultant Advantech – Microsoft Division.
Leveraging ColdSpring to build a robust Flex applications Chris Scott, Cynergy Systems.
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
Presentation transcript:

Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton February 28th, 2003 Advisor: David G. Hannay Client: Robert Berry, IBM UK Arthur Octopus The AspectJ Mascot

Agenda AOP & Cocoon Background Refactoring Goals & Process Challenges and Obstacles The Future

What is Aspect Oriented Programming? Concern – “a specific requirement or consideration that must be addressed in order to satisfy the overall system goal.” AOP introduces a new unit of modularization—an aspect–that crosscuts other modules. Aspect = pointcut + advice + intertype declaration – intertype declaration Fields and methods that the aspect manages on behalf of other types - The Java AOP implementation

A Cross-cutting concern Logging in org.Apache.Tomcat -Red shows lines of code that handles logging -Not in one place. Not in a small number of places.

Apache Cocoon: Dynamic multi-channel web publishing “Apache Cocoon is a web development framework built around the concepts of separation of concerns and component-based web development.” – Cocoon website Usage example: – Take data from a database and publish the content onto a web portal in HTML, PDF, Office format, and text format all simultaneously.

Performance as crosscutting concern Performance optimizations: Caching & Pooling – Effective techniques to improve performance Caching – recycling of resources that are expensive to create and discard where more than one user can use a single object – “Read only” – A.K.A. – “Shared Object Resource Allocation”

Cocoon Caching Architecture Caching happens at the pipeline level with each different phase of the transformation being cached, if possible. Caching

Cocoon Caching Architecture SAX events and caching management is done in a central location: CacheManager However, to be cached the classes must implement the abstract interface...cocoon.caching.CacheableProcessingComponent Two methods to be implemented: – Serializable generateKey(); – SourceValdity generateValidity();

Refactoring Cocoon Caching The Challenge: – Implementing the CacheableProcessingComponent and its methods is the crosscutting concern, we need to abstract it. Accomplished through – Introductions – in AspectJ “Intertype Declarations” The addition of methods, fields, interfaces, or inheritance information that does not directly affect the class’s behavior Simple in concept, not trivial in practice. – Large, complex web application (~4600 class files with all blocks)

AOP Adoption Value Development Support for Existing Code 15 minutes 30 lines unpluggable testing tracing performance measurement limited use design error handling standards & contracts monitoring Add Auxiliary Functionality Re-factor Core Functionality Reusable Libraries Aspect-Oriented Architecture module design persistence management security feature variations aspect libraries design patterns enterprise, department standards new services, programming model product lines extend J2EE Web services, mobile, P2P...

Goals Project Task – Refactor the caching system in Cocoon Goals - Gain experience with application of AOP to a large scale, well structured application environment. - Identify and quantify opportunities for using AOP to simplify an already modular code base. - Use AOP to enhance modularity/componentization of Cocoon.

Process: Approach 1. Used AspectJ to define a compiler warning in order to identify locations in Cocoon that implement the CacheableProcessingComponent abstract interface. 2. Wrote aspects to encapsulate the functionality. 3. Removed the code encapsulated into aspects from the base classes identified in step Wove the aspects into Cocoon using AspectJ compiler.

Step 1: Identify Locations public aspect ExploreCaching { declare warning: staticinitialization(org.apache.cocoon.caching.CacheableProcessingComponent+) && !within(org.apache.cocoon.caching..*): "Class implements cacheable"; }

Step 2: Write Caching Aspects Excerpt: 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(); } …. Introduce Interface Introduce Methods

Step 3 & 4: Remove References & Weave Code Removed

Testing & Verification Finished: – Cocoon without caching deployed In process – Integrating AspectJ Compiler into build process

Challenges & Obstacles Domain knowledge is the biggest challenge – Ex. Cache (external pipeline cache) vs. Store (Internal Object cache) Eclipse AspectJ Development Tools (1.1.4) – Scalability issues: over 4600 classes in Cocoon – Bug: Memory Leak (Fix coming in 1.2 – ‘Lancaster’) – Bug: Abstract class that extend abstract class with concrete subclasses are woven too early - (Fixed in 1.1.6) Ongoing modifications to cocoon caching system

Future work Use AOP to refactor the ‘internal cache’ Refactor other non-performance crosscutting concerns into aspects – Object Recycling, Logging, etc… An event-aware AOP caching system – Use AOP to catch SAX events and perform cache invalidations

The Future: AOP New versions, better tools – AspectJ 1.2 – “Lancaster” for Eclipse 3.0 – “Aspect Mining” – Better ways towards aspect discovery Concern Modeling Environment – – “To general software developers it offers a suite of tools for use in creating, manipulating, and evolving aspect-oriented software, across the full software lifecycle” – IBM Watson Lab – Yorktown Heights Aspect Mining Tool More work to be done: AI and pattern recognition – AOSD 2004 in Lancaster, UK, March 22-25th

Results I Question – How should you structure your application to simplify AO extendibility? Answer – Good coding practice makes AO adoption easier Standard variable naming Standard accessor methods Question – How can we improve the AO implementation? Answer – Refactor ‘similar’ code to remove differences Question – How should aspects be viewed on a design level? Answer – Still open!

Results II Summary: Abstracted 39 implementations of CacheableProcessingComponent. Used AOP to condense and remove 24 methods from the base implementation. 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(); }

Questions Oliver the Octopus Concept and name credited to: AspectJ team, IBM Hursley, UK AOP: The here, the now, and the future!