SlideShare a Scribd company logo
Aspect-oriented programming
The next level of abstraction on Android
Tibor Šrámek
AUGUST 26, 2015
2CONFIDENTIAL
Topics
Cross-cutting concerns1
Separation of cross-cutting concerns2
Basics of aspect-oriented programming3
AspectJ4
Examples5
3CONFIDENTIAL
CROSS-CUTTING CONCERNS
4CONFIDENTIAL
Cross-cutting concerns
Module 1
Module 3
Module 2
Event
Tracking
Caching
Logging
Error
tracking
Event
tracking 2
Event
tracking 3
Module 4
Imagine a simple system
5CONFIDENTIAL
Cross-cutting concerns
Module 1 Module 2 Module 3 Module 4 Module 5
original functionality functionality 1 functionality 2 functionality 3
functionality 4 functionality 5 functionality 6 functionality 7
Tangled & redundant code
6CONFIDENTIAL
AOP
7CONFIDENTIAL
What is AOP?
Module 1 Module 2 Module 3 Module 4 Module 5
original functionality functionality 1 functionality 2 functionality 3
functionality 4 functionality 5 functionality 6 functionality 7
8CONFIDENTIAL
What is AOP?
Modules in one layer
CCCs in a separate layer extracted from the
original modules (AOP is the glue)
9CONFIDENTIAL
What is AOP?
•AOP is an extension of OOP
•It increases modularity by the separation of CCCs
•Decreases code redundancy
•Adds functionality using injection without
modifying the original code
•Besides CCC separation it gives us power…
10CONFIDENTIAL
ASPECTJ
11CONFIDENTIAL
What is AspectJ?
•It’s an AOP extension for Java
•Very powerful
•Easy to learn and use
•Java code is valid AspectJ code
•AspectJ = Java + some magic
12CONFIDENTIAL
AOP terminology
•Advice - injected code
•Join point - a point of execution
•Pointcut - point of injection (set of JPs)
•Aspect - advice + pointcut
•Weaving - process of injection
13CONFIDENTIAL
Weaving
Weaving can be static (compile-time)
or dynamic (runtime)
14CONFIDENTIAL
Android integration
// build.gradle
apply plugin: 'android-aspectj'
buildscript {
dependencies {
classpath 'com.uphyca.gradle:gradle-android-aspectj-plugin:0.9.12'
}
}
// an annotation style AspectJ example aspect
@Aspect
public class LoggerAspect {
@Before("call(* MyClass.myMethod())")
public void onMyMethodCalled() {
Logger.log("My method is called.");
}
}
15CONFIDENTIAL
Advice types
•Before
code will be injected before the
given join point
•After
code will be injected after the
given join point
•Around
code will be injected instead of
the given join point
• AfterReturning, AfterThrowing
@Before("myPointcut()")
public void myAdvice() {
// do something here, e.g. null-guarding
}
@After("call(int *.*View+.get*(..))")
public void myAdvice(JoinPoint joinPoint) {
// A JoinPoint object contains information
about the execution context(method signature,
arguments, containing class, etc.)
}
@Around("myPointcut1() && !myPointCut2()")
public void myAdvice(ProceedingJoinPoint point) {
// Pre processing work..
point.proceed();
// Post processing work..
// Around is perfect e.g. to skip a method
if a parameter is null or to replace
a buggy method in a library
}
16CONFIDENTIAL
Pointcuts
•Method: call() & execution()
•Constructor: call() & execution()
•Field access: get() & set()
"execution(* *.myMethod(..))"
"call(private MyType.new(..))"
"get(String MyClass.name)"
Signature:
<modifiers> <return_value> <type>.<method_name>(parameter_list)
Signature:
<modifiers> <class_type>.new(<parameter_list>)
Signature:
<field_type> <class_type>.<field_name>
17CONFIDENTIAL
Advanced pointcuts
•Class initialization
•Object initialization
•Advice execution
•Exception handling
•Annotations
•Etc. (virtually any point in the execution)
18CONFIDENTIAL
Aspects
Aspects can:
•contain regular fields & methods
(e.g. for counting)
•track private fields & methods
(don’t have to break encapsulation)
•inherit from other aspects
(e.g. for reusing advices)
19CONFIDENTIAL
Aspects
Aspects also can:
•be inner classes
•be instantiated
•declare advice execution order
•implement inter-type declarations
20CONFIDENTIAL
USE CASES
21CONFIDENTIAL
Common applications of AOP
•Logging
•Tracking (event, error, performance)
•Persistence
•Validation
•Synchronization
•Security
22CONFIDENTIAL
AspectJ
Is it good for anything else besides the
separation of CCCs?
•Skip or replace methods
•Prevent or handle errors
•Dependency injection
•Separation of architectural layers
23CONFIDENTIAL
Dependency injection with AOP
Consider Dagger, if you want to satisfy a dependency
you have to:
•make a module
•make a component
•modify the dependent class
24CONFIDENTIAL
Dependency injection with AOP
With AOP you only have to do this:
@Aspect
class DependencyInjector {
@After("execution(Dependent.new(..))")
public void inject(JoinPoint p) {
Dependent dependent = (Dependent) p.getThis();
dependent.dependency = new Dependency();
}
}
25CONFIDENTIAL
Architecture with AOP
Imagine a simple architecture
@Aspect
public class MyAspect {
private MyView view;
private MyPresenter presenter;
private MyProvider provider;
@After("execution(MyView.onCreate(..))")
private void init(JoinPoint jp) {
view = (MyView) jp.getThis();
presenter = new MyPresenter();
provider = new MyProvider();
}
@After("execution(MyView.myButtonClicked(..))")
private void myButtonClicked() {
presenter.createRequest();
}
@AfterReturning(pointcut = "execution(MyPresenter.createRequest(..))",
returning = "request")
private void requestCreated(Request request) {
provider.sendRequest(request);
}
@After("execution(MyProvider.onResponse(..))")
private void responseArrived(JoinPoint jp) {
String result = presenter.processResponse((Response) jp.getArgs()[0]);
view.showResult(result);
}
}
26CONFIDENTIAL
Architecture with AOP
A system like this is:
•Modular (e.g. multiple presenters for a view)
•Flexible (e.g. don’t have to use interfaces)
•Easy to test (don’t have to mock anything,
test only what you want)
27CONFIDENTIAL
Tips & tricks
You have to implement something
• that probably will be removed in the future?
Put it to an aspect! You will have to just delete the aspect.
• for only one build variant? Put it to an aspect in that variant!
In many cases you will have to implement only the differences.
Unleash your imagination…
(but don’t try to build the whole system with aspects)
28CONFIDENTIAL
OUTRO
29CONFIDENTIAL
AOP supported languages
• Java
• Objective-C
• .NET (C# / VB.NET)
• C / C++
• Python
• Perl
• PHP
• JavaScript
• Groovy
• Ruby
• ActionScript
• Ada
• AutoHotkey
• COBOL
• ColdFusion
• Lisp
• Delphi
• Haskell
• Logtalk
• Lua
• Matlab
• Prolog
• Racket
• Smalltalk
• Etc.
30CONFIDENTIAL
Active users of AOP
•Microsoft
•Oracle
•IBM
•SAP
•Siemens
•Red Hat
•Epam
There is a whole paradigm called Aspect-oriented software development…
31CONFIDENTIAL
Useful links
• http://www.eclipse.org/aspectj
• http://fernandocejas.com/2014/08/03/aspect-oriented-programming-in-android
• https://github.com/uPhyca/gradle-android-aspectj-plugin
• https://www.youtube.com/watch?v=cq7wpLI0hco
• Google is your friend 
32CONFIDENTIAL
Literature
• Robert E. Filman, Tzilla Elrad, Siobhan Clarke, Mehmet Aksit: Aspect-Oriented Software
Development. Addison-Wesley Professional, October 2004, 800 pp. ISBN: 0321219767.
• Renaud Pawlak, Jean-Philippe Retaillé, Lionel Seinturier: Foundations of AOP for J2EE Development.
Apress, September 2005, 352 pp. ISBN: 1590595076.
• Ramnivas Laddad: AspectJ in Action: Practical Aspect-Oriented Programming. Manning Publications,
July 2003, 512 pp. ISBN: 1930110936.
• Siobhan Clarke, Elisa Baniassad: Aspect-Oriented Analysis and Design: The Theme Approach.
Addison-Wesley Professional, March 2005, 400 pp. ISBN: 0321246748.
• Ivar Jacobson, Pan-Wei Ng: Aspect-Oriented Software Development with Use Cases. Addison-Wesley
Professional, December 2004, 464 pp. ISBN: 0321268881.
• Joseph D. Gradecki, Nicholas Lesiecki: Mastering AspectJ: Aspect-Oriented Programming in Java.
Wiley, April 2003, 456 pp. ISBN: 0471431044.
• Russell Miles: Aspectj Cookbook. O'Reilly Media, December 2004, 331 pp. ISBN: 0596006543.
33CONFIDENTIAL
@After(“execution(* Presenter.present()”)
void endPresentation() {
presenter.say(
” Thank You”
);}

More Related Content

PPTX
AspectJ Android with Example
PPTX
AQA TALKS 4 - AUTOMATION TEST REPORTER
PPTX
Automation is Easy! (python version)
ODP
Weaving aspects in PHP with the help of Go! AOP library
PDF
Robot Framework with actual robot
PDF
Barcamp Bangkhen :: Robot Framework
PDF
Automation using RobotFramework for embedded device
PDF
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...
AspectJ Android with Example
AQA TALKS 4 - AUTOMATION TEST REPORTER
Automation is Easy! (python version)
Weaving aspects in PHP with the help of Go! AOP library
Robot Framework with actual robot
Barcamp Bangkhen :: Robot Framework
Automation using RobotFramework for embedded device
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...

What's hot (20)

PDF
Functional Tests Automation with Robot Framework
PPTX
Robot Framework : Lord of the Rings By Asheesh M
PDF
Introduction to Robot Framework
PDF
Robot framework - Lord of the Rings
PDF
Solving cross cutting concerns in PHP - PHPSerbia-2017
PDF
Efficient mobile automation
PPTX
Robot framework Gowthami Goli
PPT
Specs2 3.0
PDF
Acceptance Test Drive Development with Robot Framework
PPTX
Javascript unit tests with angular 1.x
PDF
Test automation design patterns
PDF
Robot Framework Introduction & Sauce Labs Integration
PPTX
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
PDF
Introduction to Robot Framework – Exove
PPTX
Renaissance of JUnit - Introduction to JUnit 5
PDF
Eclipse Testing Day 2010. Xored Q7
PDF
Introduction to Robot Framework
PPTX
Introduction to robot framework
PDF
利用 Appium + Robot Framework 實現跨平台 App 互動測試
PDF
Head first android apps dev tools
Functional Tests Automation with Robot Framework
Robot Framework : Lord of the Rings By Asheesh M
Introduction to Robot Framework
Robot framework - Lord of the Rings
Solving cross cutting concerns in PHP - PHPSerbia-2017
Efficient mobile automation
Robot framework Gowthami Goli
Specs2 3.0
Acceptance Test Drive Development with Robot Framework
Javascript unit tests with angular 1.x
Test automation design patterns
Robot Framework Introduction & Sauce Labs Integration
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Introduction to Robot Framework – Exove
Renaissance of JUnit - Introduction to JUnit 5
Eclipse Testing Day 2010. Xored Q7
Introduction to Robot Framework
Introduction to robot framework
利用 Appium + Robot Framework 實現跨平台 App 互動測試
Head first android apps dev tools
Ad

Viewers also liked (8)

ODP
Aspect Oriented Programming (AOP) - A case study in Android
PDF
Integrating MQ Protocols with WSO2 ESB 4.9.0 (RabbitMQ, MQTT, Kafka)
PDF
ProGuard / DexGuard Tips and Tricks
DOCX
Retos del Egresado de Ingeniería Civil ante el paradigma de la sustentabilida...
PDF
Programación Orientada a Aspectos (POA)
PPT
Design pattern in android
PPTX
Unit testing powershell
PDF
Software Design patterns on Android English
Aspect Oriented Programming (AOP) - A case study in Android
Integrating MQ Protocols with WSO2 ESB 4.9.0 (RabbitMQ, MQTT, Kafka)
ProGuard / DexGuard Tips and Tricks
Retos del Egresado de Ingeniería Civil ante el paradigma de la sustentabilida...
Programación Orientada a Aspectos (POA)
Design pattern in android
Unit testing powershell
Software Design patterns on Android English
Ad

Similar to AOP on Android (20)

PDF
Code quality par Simone Civetta
PDF
Python testing like a pro by Keith Yang
PPTX
OpenDaylight Developer Experience 2.0
PDF
Scaffolding with JMock
PPTX
UML for Aspect Oriented Design
PDF
Getting Started with C++
PDF
Exciting Features and Enhancements in Java 23 and 24
PPTX
Java Micro-Benchmarking
PDF
Getting started with C++
PDF
Building modular software with OSGi - Ulf Fildebrandt
PPTX
Introduction to Aspect Oriented Programming
PDF
A Journey through the JDKs (Java 9 to Java 11)
PDF
Unleashing the Java Tooling in Eclipse IDE - Tips & Tricks!
PPTX
Spring framework part 2
PDF
Advanced debugging
PDF
CBDW2014 - MockBox, get ready to mock your socks off!
PDF
Ehsan parallel accelerator-dec2015
ODP
DelOps vs. DevOps
PDF
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
PPTX
Code quality par Simone Civetta
Python testing like a pro by Keith Yang
OpenDaylight Developer Experience 2.0
Scaffolding with JMock
UML for Aspect Oriented Design
Getting Started with C++
Exciting Features and Enhancements in Java 23 and 24
Java Micro-Benchmarking
Getting started with C++
Building modular software with OSGi - Ulf Fildebrandt
Introduction to Aspect Oriented Programming
A Journey through the JDKs (Java 9 to Java 11)
Unleashing the Java Tooling in Eclipse IDE - Tips & Tricks!
Spring framework part 2
Advanced debugging
CBDW2014 - MockBox, get ready to mock your socks off!
Ehsan parallel accelerator-dec2015
DelOps vs. DevOps
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)

Recently uploaded (20)

PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
System and Network Administration Chapter 2
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
ai tools demonstartion for schools and inter college
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
medical staffing services at VALiNTRY
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
wealthsignaloriginal-com-DS-text-... (1).pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Odoo Companies in India – Driving Business Transformation.pdf
System and Network Administration Chapter 2
Wondershare Filmora 15 Crack With Activation Key [2025
2025 Textile ERP Trends: SAP, Odoo & Oracle
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
ai tools demonstartion for schools and inter college
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
medical staffing services at VALiNTRY
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
How to Migrate SBCGlobal Email to Yahoo Easily
Operating system designcfffgfgggggggvggggggggg
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Understanding Forklifts - TECH EHS Solution
Which alternative to Crystal Reports is best for small or large businesses.pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Upgrade and Innovation Strategies for SAP ERP Customers

AOP on Android

  • 1. Aspect-oriented programming The next level of abstraction on Android Tibor Šrámek AUGUST 26, 2015
  • 2. 2CONFIDENTIAL Topics Cross-cutting concerns1 Separation of cross-cutting concerns2 Basics of aspect-oriented programming3 AspectJ4 Examples5
  • 4. 4CONFIDENTIAL Cross-cutting concerns Module 1 Module 3 Module 2 Event Tracking Caching Logging Error tracking Event tracking 2 Event tracking 3 Module 4 Imagine a simple system
  • 5. 5CONFIDENTIAL Cross-cutting concerns Module 1 Module 2 Module 3 Module 4 Module 5 original functionality functionality 1 functionality 2 functionality 3 functionality 4 functionality 5 functionality 6 functionality 7 Tangled & redundant code
  • 7. 7CONFIDENTIAL What is AOP? Module 1 Module 2 Module 3 Module 4 Module 5 original functionality functionality 1 functionality 2 functionality 3 functionality 4 functionality 5 functionality 6 functionality 7
  • 8. 8CONFIDENTIAL What is AOP? Modules in one layer CCCs in a separate layer extracted from the original modules (AOP is the glue)
  • 9. 9CONFIDENTIAL What is AOP? •AOP is an extension of OOP •It increases modularity by the separation of CCCs •Decreases code redundancy •Adds functionality using injection without modifying the original code •Besides CCC separation it gives us power…
  • 11. 11CONFIDENTIAL What is AspectJ? •It’s an AOP extension for Java •Very powerful •Easy to learn and use •Java code is valid AspectJ code •AspectJ = Java + some magic
  • 12. 12CONFIDENTIAL AOP terminology •Advice - injected code •Join point - a point of execution •Pointcut - point of injection (set of JPs) •Aspect - advice + pointcut •Weaving - process of injection
  • 13. 13CONFIDENTIAL Weaving Weaving can be static (compile-time) or dynamic (runtime)
  • 14. 14CONFIDENTIAL Android integration // build.gradle apply plugin: 'android-aspectj' buildscript { dependencies { classpath 'com.uphyca.gradle:gradle-android-aspectj-plugin:0.9.12' } } // an annotation style AspectJ example aspect @Aspect public class LoggerAspect { @Before("call(* MyClass.myMethod())") public void onMyMethodCalled() { Logger.log("My method is called."); } }
  • 15. 15CONFIDENTIAL Advice types •Before code will be injected before the given join point •After code will be injected after the given join point •Around code will be injected instead of the given join point • AfterReturning, AfterThrowing @Before("myPointcut()") public void myAdvice() { // do something here, e.g. null-guarding } @After("call(int *.*View+.get*(..))") public void myAdvice(JoinPoint joinPoint) { // A JoinPoint object contains information about the execution context(method signature, arguments, containing class, etc.) } @Around("myPointcut1() && !myPointCut2()") public void myAdvice(ProceedingJoinPoint point) { // Pre processing work.. point.proceed(); // Post processing work.. // Around is perfect e.g. to skip a method if a parameter is null or to replace a buggy method in a library }
  • 16. 16CONFIDENTIAL Pointcuts •Method: call() & execution() •Constructor: call() & execution() •Field access: get() & set() "execution(* *.myMethod(..))" "call(private MyType.new(..))" "get(String MyClass.name)" Signature: <modifiers> <return_value> <type>.<method_name>(parameter_list) Signature: <modifiers> <class_type>.new(<parameter_list>) Signature: <field_type> <class_type>.<field_name>
  • 17. 17CONFIDENTIAL Advanced pointcuts •Class initialization •Object initialization •Advice execution •Exception handling •Annotations •Etc. (virtually any point in the execution)
  • 18. 18CONFIDENTIAL Aspects Aspects can: •contain regular fields & methods (e.g. for counting) •track private fields & methods (don’t have to break encapsulation) •inherit from other aspects (e.g. for reusing advices)
  • 19. 19CONFIDENTIAL Aspects Aspects also can: •be inner classes •be instantiated •declare advice execution order •implement inter-type declarations
  • 21. 21CONFIDENTIAL Common applications of AOP •Logging •Tracking (event, error, performance) •Persistence •Validation •Synchronization •Security
  • 22. 22CONFIDENTIAL AspectJ Is it good for anything else besides the separation of CCCs? •Skip or replace methods •Prevent or handle errors •Dependency injection •Separation of architectural layers
  • 23. 23CONFIDENTIAL Dependency injection with AOP Consider Dagger, if you want to satisfy a dependency you have to: •make a module •make a component •modify the dependent class
  • 24. 24CONFIDENTIAL Dependency injection with AOP With AOP you only have to do this: @Aspect class DependencyInjector { @After("execution(Dependent.new(..))") public void inject(JoinPoint p) { Dependent dependent = (Dependent) p.getThis(); dependent.dependency = new Dependency(); } }
  • 25. 25CONFIDENTIAL Architecture with AOP Imagine a simple architecture @Aspect public class MyAspect { private MyView view; private MyPresenter presenter; private MyProvider provider; @After("execution(MyView.onCreate(..))") private void init(JoinPoint jp) { view = (MyView) jp.getThis(); presenter = new MyPresenter(); provider = new MyProvider(); } @After("execution(MyView.myButtonClicked(..))") private void myButtonClicked() { presenter.createRequest(); } @AfterReturning(pointcut = "execution(MyPresenter.createRequest(..))", returning = "request") private void requestCreated(Request request) { provider.sendRequest(request); } @After("execution(MyProvider.onResponse(..))") private void responseArrived(JoinPoint jp) { String result = presenter.processResponse((Response) jp.getArgs()[0]); view.showResult(result); } }
  • 26. 26CONFIDENTIAL Architecture with AOP A system like this is: •Modular (e.g. multiple presenters for a view) •Flexible (e.g. don’t have to use interfaces) •Easy to test (don’t have to mock anything, test only what you want)
  • 27. 27CONFIDENTIAL Tips & tricks You have to implement something • that probably will be removed in the future? Put it to an aspect! You will have to just delete the aspect. • for only one build variant? Put it to an aspect in that variant! In many cases you will have to implement only the differences. Unleash your imagination… (but don’t try to build the whole system with aspects)
  • 29. 29CONFIDENTIAL AOP supported languages • Java • Objective-C • .NET (C# / VB.NET) • C / C++ • Python • Perl • PHP • JavaScript • Groovy • Ruby • ActionScript • Ada • AutoHotkey • COBOL • ColdFusion • Lisp • Delphi • Haskell • Logtalk • Lua • Matlab • Prolog • Racket • Smalltalk • Etc.
  • 30. 30CONFIDENTIAL Active users of AOP •Microsoft •Oracle •IBM •SAP •Siemens •Red Hat •Epam There is a whole paradigm called Aspect-oriented software development…
  • 31. 31CONFIDENTIAL Useful links • http://www.eclipse.org/aspectj • http://fernandocejas.com/2014/08/03/aspect-oriented-programming-in-android • https://github.com/uPhyca/gradle-android-aspectj-plugin • https://www.youtube.com/watch?v=cq7wpLI0hco • Google is your friend 
  • 32. 32CONFIDENTIAL Literature • Robert E. Filman, Tzilla Elrad, Siobhan Clarke, Mehmet Aksit: Aspect-Oriented Software Development. Addison-Wesley Professional, October 2004, 800 pp. ISBN: 0321219767. • Renaud Pawlak, Jean-Philippe Retaillé, Lionel Seinturier: Foundations of AOP for J2EE Development. Apress, September 2005, 352 pp. ISBN: 1590595076. • Ramnivas Laddad: AspectJ in Action: Practical Aspect-Oriented Programming. Manning Publications, July 2003, 512 pp. ISBN: 1930110936. • Siobhan Clarke, Elisa Baniassad: Aspect-Oriented Analysis and Design: The Theme Approach. Addison-Wesley Professional, March 2005, 400 pp. ISBN: 0321246748. • Ivar Jacobson, Pan-Wei Ng: Aspect-Oriented Software Development with Use Cases. Addison-Wesley Professional, December 2004, 464 pp. ISBN: 0321268881. • Joseph D. Gradecki, Nicholas Lesiecki: Mastering AspectJ: Aspect-Oriented Programming in Java. Wiley, April 2003, 456 pp. ISBN: 0471431044. • Russell Miles: Aspectj Cookbook. O'Reilly Media, December 2004, 331 pp. ISBN: 0596006543.

Editor's Notes

  • #2: Presenter: Tibor Šrámek (tibor_sramek@epam.com)
  • #3: AOP is a huge topic. This is just a quick teaser but at the end You will be able to use it and see if it’s worth to try.
  • #5: Connections between modules and functionalities can get out of hand really fast.
  • #6: CCCs are functionalities spreading all over a system (with modules which are heavily dependent and hard to test). They undermine the Single Responsibility Principle and increase code redundancy.
  • #8: This is AOP in one picture. A system like this would make work easier. But how to achieve it?
  • #10: AOP was made for CCC separation but that doesn’t mean it’s not good for other things. Enum wasn’t made for singleton creation, but what if You have to make a thread-safe singleton?
  • #11: Let’s see an AOP implementation
  • #14: We want to see clean modules. Let the machines work with tangled code. Static weaving is the most common and the fastest.
  • #15: Integration and example on one page. AspectJ is an Eclipse Foundation product. Eclipse users can use keywords instead of annotations and they don’t have to write strings. But this style isn’t bad either and there can be a similar plugin for the Android Studio in the future.
  • #16: AfterReturning gives us the returned object and AfterThrowing the thrown exception. * - any characters except the ‘.’ .. – any characters including the ‘.’ + - any subclasses or subinterfaces
  • #17: With constructor pointcuts You can e.g. implement dependency injection. With field access pointcuts You can e.g. implement field validation.
  • #18: Annotations are handy if You can’t fine common things in join points.
  • #19: If we mess something up the error manifests during the compilation
  • #20: If we mess something up the error manifests during the compilation. Virtually we can inject anything and anywhere.
  • #25: You can also define injections for field accesses. Build time is faster than with Dagger.
  • #26: If modules don’t know about each other they are not depending on each other
  • #29: I hope You are interested….
  • #30: Mainstream languages have AOP support
  • #32: The official documentation, a good Android-AOP tutorial, the plugin’s repo and an interesting presentation by Gregor Kiczales (one of the fathers of AOP) There are tons of AOP blogs and tutorials on the web
  • #33: If someone likes to read from paper….
  • #34: Presenter: Tibor Šrámek (tibor_sramek@epam.com)