Aspect-Oriented Programming In Eclipse ® Aspect-Oriented Programming in Eclipse with AspectJ Dr Helen Hawkins and Sian January.

Slides:



Advertisements
Similar presentations
A Brief Introduction to Aspect-Oriented Programming Zhenxiao Yang.
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.
ASTA Aspect Software Testing Assistant Juha Gustafsson, Juha Taina, Jukka Viljamaa University of Helsinki.
©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.
Overview of AspectJ Aspect Oriented Software Development Seminar Technion presented by Oren Mishali.
University of British Columbia Software Practices Lab Fluid AOP Join Point Models Terry Hon Gregor Kiczales.
University of British Columbia Software Practices Lab 2005 CASCON A Fluid AOP Editor Terry Hon Gregor Kiczales.
October - December 2013CSC5021: The Problem With Aspects (J P Gibson)1 The Problem With Aspects (AOP) A style of programming that attempts to abstract.
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.
Harmless Advice Daniel S Dantas Princeton University with Prof. David Walker.
(c) Copyright Palo Alto Research Center Incroporated. All rights reserved.1 AO Tools: State of the (AspectJ™) Art and Open Problems Mik Kersten.
Deriving AO Software Architectures using the AO-ADL Tool Suite Luis Fernández, Lidia Fuentes, Mónica Pinto, Juan A. Valenzuela Universidad de Málaga
Introduction to Aspect- Oriented Programming CS 3360 Gregor Kiczales, et. al. Getting started with AspectJ, CACM, 44(10):59-65, October Fall 2012.
Software Engineering Muhammad Fahad Khan
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse.
Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.
Introduction to AOP.
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.
Bologna, September 2003 Giorgia Lodi Department of Computer Science University of Bologna V.Ghini, F. Panzieri.
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.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 09. Review Introduction to architectural styles Distributed architectures – Client Server Architecture – Multi-tier.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development 1.
Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, System and Software Engineering.
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 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.
Methodology: The AOP Refactoring Process Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton Advisor:
AOSD1 Aspect-Oriented Software Design Karl Lieberherr Theo Skotiniotis.
A Presentation By V AIBHAV S AHARAN Web-enHanced Information Management COMS E6125.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
Introduction Better Faster Cheaper (pick any two) On-going issue that continues to motivate research in software engineering Applications: –continue to.
1 An Aspect-Oriented Implementation Method Sérgio Soares CIn – UFPE Orientador: Paulo Borba.
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.
Chapter 8: Aspect Oriented Programming Omar Meqdadi SE 3860 Lecture 8 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
AOP-Driven Variability in Software Product Lines Vander Alves, Ayla Dantas, and Paulo Borba Informatics Center – UFPE – Brazil
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
Towards an Aspect-oriented Language Module: Aspects for Petri Nets Tim Molderez, Bart Meyers, Dirk Janssens and Hans Vangheluwe Ansymo Antwerp Systems.
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.
Comparison of Different AOP Approaches Presented by: Xiaojing Wang.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
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.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
R R R A Brief Introduction to Aspect-Oriented Programming.
Introduction to Aspect- Oriented Programming CS 3360 Gregor Kiczales, et. al. Getting started with AspectJ, CACM, 44(10):59-65, October Spring 2012.
Aspect-Oriented Software Development (AOSD)
AspectJ Development Tools Mik Kersten University of British Columbia October 28, 2003.
aspectj tools new and noteworthy Mik Kersten University of British Columbia Andy Clement, George Harley IBM Hursley Labs.
L’origine dei mali: le dipendenze tra componenti Stefano Leli 14° Workshop DotNetMarche Venerdì 16 aprile
PPL 2004, Gamagori, AICHI1 Remote Pointcut - A Language Construct for Distributed AOP Muga Nishizawa (Tokyo Tech, Japan) Shigeru Chiba (Tokyo Tech, Japan)
Chengyu Sun California State University, Los Angeles
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Aspect-Oriented Design and Patterns
Chengyu Sun California State University, Los Angeles
Structuring Adaptive Applications using AspectJ and AOM
Aspect-oriented programming
CS520 Web Programming Spring – Aspect Oriented Programming
AspectAda Aspect-Oriented Programming for Ada95
Presentation transcript:

Aspect-Oriented Programming In Eclipse ® Aspect-Oriented Programming in Eclipse with AspectJ Dr Helen Hawkins and Sian January

Aspect-Oriented Programming in Eclipse Outline  The need for Aspect-Oriented Programming (AOP)  An introduction to AspectJ  AspectJ Demos  Adopting AOP  Further information

Aspect-Oriented Programming in Eclipse The 1-to-1 idea: Good modularity  One requirement in your design maps to one module in your implementation  For example – Chess Piece, Chess Board, Player  Clear, simple, direct mapping  Modules are  easy to add  easy to remove  easy to maintain

Aspect-Oriented Programming in Eclipse The 1-to-1 idea: Good modularity  Socket Creation in Apache Tomcat  Red shows the relevant lines of code  Nicely fits into one package – 3 classes

Aspect-Oriented Programming in Eclipse When things go wrong…  Logging in Tomcat  Scattered and tangled throughout all the packages  Bad Modularity – 1-to-n mapping

Aspect-Oriented Programming in Eclipse The trouble with 1-to-n  Redundant code  Same fragment of code in many places  e.g. trace.entry(); trace.exit();  Difficult to understand  Mapping from the requirement is unclear  Structure is not explicit  Difficult to change  Have to find all the code involved  And be sure to change it consistently  And be sure not to break it by accident

Aspect-Oriented Programming in Eclipse n-to-1 and n-to-n  A consequence of the 1- to-n problem  Modules are no longer well defined

Aspect-Oriented Programming in Eclipse Code View of n-n try { if (!removed) entityBean.ejbPassivate(); setState( POOLED ); } catch (RemoteException ex ) { FFDCEngine.processException( ex,”EBean.passivate()”,”237”, this); destroy(); throw ex; } finally { if (!removed && statisticsCollector != null) { statisticsCollector. recordPassivation(); } removed = false; beanPool.put( this ); if (Logger.isEnabled) { Logger.exit(tc,”passivate”); } try { if (!removed) entityBean.ejbPassivate(); setState( POOLED ); } catch (RemoteException ex ) { destroy(); throw ex; } finally { removed = false; beanPool.put( this ); } Example: Code to handle EJB Entity bean passivation Tangled Core Logic

Aspect-Oriented Programming in Eclipse Aspect-Oriented Software Development …  Recognises crosscutting concerns:  Are inherent in any complex system  Have a clear purpose  Have a natural structure  Captures crosscutting concerns explicitly:  In a modular way  With linguistic and tool support

Aspect-Oriented Programming in Eclipse AspectJ  An aspect oriented programming (AOP) language  Java language extension  Divides system into  core concerns (classes)  crosscutting concerns (aspects)  Broad IDE support  Eclipse, Emacs, JBuilder, NetBeans, …

Aspect-Oriented Programming in Eclipse AOP Concepts  Join points  Pointcuts  Advice  Aspects

Aspect-Oriented Programming in Eclipse Join Points  Events in the execution of a program  Types of Join Points :  Method & Constructor call  Method & Constructor execution advice execution  Field get & set  Exception handler execution  Static & dynamic initialization

Aspect-Oriented Programming in Eclipse What’s a Pointcut?  Pointcut  Picks out join points in a particular system  e.g. call of method ‘foo()’, set of field ‘x’, constructor for object ‘Fred’  Can also expose context from the matched join point

Aspect-Oriented Programming in Eclipse Types of Pointcuts  Event based - well defined execution points, e.g.  method calls, executions  field gets / sets  exception handling  object and class initialisation  Scoping - only select join points within a certain scope, e.g.  within a set of packages,  within the implementation of a method,  in the control flow of some event (e.g. downstream of an unsecured call)  Context matching - expose context at the join point, e.g.  identity of the caller or target object  exception being handled  value being put into a field

Aspect-Oriented Programming in Eclipse What’s Advice?  Java code to execute when conditions of a pointcut are met.  Can be parameterized to process context exposed by the pointcut

Aspect-Oriented Programming in Eclipse Types of Advice  before()  Executes before the join point  after() throwing/returning  Executes after the join point, execution can be made conditional on how join point exits (i.e. with/without exception)  around()  Executes ‘instead of’ the join point – has a choice about whether to invoke the original logic

Aspect-Oriented Programming in Eclipse What is an Aspect?  Aspects are...  At the design level … concerns that crosscut  At the implementation level … a programming construct Aspect = pointcut + advice

Aspect-Oriented Programming in Eclipse Demos – AJDT  AspectJ Development Tools (AJDT) for Eclipse  Open Source  Developed in Hursley  Partnership with AspectJ team 

Aspect-Oriented Programming in Eclipse Demos  Demo 1: A Simple Figure Editor  Demo 2: Web Services Invocation Framework

Aspect-Oriented Programming in Eclipse Web Services Invocation Framework (WSIF)  Middleware component  Simple Java API for invoking web services, no matter how or where they are provided  Released to Apache  But IBM wants a version tightly coupled to IBM’s normal ‘qualities of service’ IBM tracing/monitoring/management  How do we manage this?

Aspect-Oriented Programming in Eclipse Exploring Re-Use: The WSIF Story org.apache.wsif WebSphere RAS WebSphere FFDC WebSphere PMI + WSIF for Open Source Community Composition WSIF for WebSphere

Aspect-Oriented Programming in Eclipse Applications of AOP  Problem determination  Logging, FFDC, performance monitoring  Architectural rule enforcement  Contracts, encapsulation, separation (no “up calls”)  Other concerns  Security, transactions, persistence, caching/pooling, locking  Open source integration

Aspect-Oriented Programming in Eclipse Adopting AOP reward time & confidence auxiliary / infrastructure core / business AO Analysis, AO Design, AO Strategy exploration enforcement

Aspect-Oriented Programming in Eclipse Further information  AspectJ home page:  AJDT home page:  Pick up a book …  us:  Helen Hawkins:  Sian January: