130 likes | 241 Views
Aspect-Oriented Programming with AJDT. Adrian Colyer Mik Kersten Andy Clement. Contents. AJDT overview Program Comprehension in AJDT Outline View, Gutter Annotations, Visualiser, Debugger Future Directions for AJDT
E N D
Aspect-Oriented Programming with AJDT Adrian Colyer Mik Kersten Andy Clement
Contents • AJDT overview • Program Comprehension in AJDT • Outline View, Gutter Annotations, Visualiser, Debugger • Future Directions for AJDT • Tool Tips, Content Assist, Enhanced Debugging, Pointcut Wizard, Pointcut Query, Pointcut Reader, Crosscutting Diff View, Refactoring, Deeper JDT embedding, etc… • Summary
What is AJDT? “AspectJ Development Tools for Eclipse” • Comprehensive tool support for using AspectJ in Eclipse • Integrating the AspectJ compiler • New editors/views/wizards for working with AspectJ artefacts • Tool support is critical for AOP • For day to day development of AO programs • For learning AO concepts and understanding the power of AO
The outline view • Shows aspect structure post compilation: • Advice • Inter-type declarations • Declared warnings/errors • Defined Pointcuts • Useful feedback loop • Did my pointcut match anything? • Fully navigable • Jump to advised locations
Source Annotations • Gutter annotations in editor view • Highlight lines affected by advice • Hover help shows advice in affect • Context menu for annotations allows navigation to advice • Important visual cue for developers • Not all users have the outline view active
Aspect Visualiser ‘A picture is worth a 1000 words’ • Provides visual overview of the entire system • Shows scattering, tangling, crosscutting • SeeSoft style • Optionally: • Look at affect of particular aspects • View at the package or class level • Navigate from affected lines back to source • Even zoom in !
Debugging • Stepping through AO code enhances program understanding • Not just for fixing bugs! • AJDT allows the user to step into advice affecting a method Stepping through before advice
Future Direction of AJDT • New features for newcomers and experts • Making AJDT more extensible • Extension points for new contributions • Making AJDT even more robust • Ensure it scales for use on large systems (~15000 classes) • Deeper integration with the Eclipse JDT • Making AO development more seamless in Eclipse • See full list of enhancements on the project website: • http://eclipse.org/ajdt and click ‘Work tasks’ • The next few pages describe some potential new features…
Futures: tool tips and content assist • Tool tips • Provides hover help for aspectj keywords • Parameter hints when defining pointcuts • Content Assist • Extended version of Java content assist for AspectJ • Completion of: • AspectJ keywords • Pointcut names
Futures:pointcut wizard, reader, query view • Pointcut wizard • For newcomers to AspectJ: Defining pointcuts correctly is hard • Wizard is a step-by-step dialog to building a pointcut • Teaching good style, common idioms, AO thinking • Pointcut reader • Intelligent tooltip for a pointcut • Interprets a pointcut definition in plain English: call(private *.set*(..,int)) => “A call made to a private method ‘set*’ defined on any type whose last argument is an int” • Pointcut query facility • To assist with aspect mining, refactoring • Simple view with text area – enter a pointcut expression and click ‘evaluate’ • View shows places in the source that are matched by that expression • Basically: a shortcut to the ‘declare warning’ method of code investigation
Futures:crosscutting diff view • Supports the extract to advice/aspect refactoring • Normal (manual!) refactoring process • Explore the code with ‘declare warning’ to work out the policy • Encapsulate the policy/behaviour in an aspect • Check that the aspect advises all the places that the warning identified • This final step would be easier with some UI support (the diff view) The view highlights difference between two patterns
Futures:enhanced debugging & refactoring • Enhanced debugging • Current support is limited • No breakpoints in aspects • Stepping into around advice is problematic without JSR45 support • Need to eliminate the traces of generated ajc names in stack trace entries • By exposing compiler internals, it promotes the wrong kind of thinking about AO • Refactoring • Simple refactoring issues: supporting ‘rename’ – with advice in affect based on names, rename can have significant implications • Aspect refactorings: ‘extract to aspect’, ‘move to inter-type declaration’
Summary and further resources • AJDT already has a rich set of features for working with AO systems but there is still lots to do! • Eclipse AspectJ Development Tools • http://www.eclipse.org/ajdt • Join in on the newsgroup and mailing list ! • Eclipse main page • http://www.eclipse.org • Eclipse AspectJ project • http://www.eclipse.org/aspectj • Email: • Adrian adrian_colyer@uk.ibm.com • Mik beatmik@acm.org • Andy clemas@uk.ibm.com