28
AOP A case-study in Android by Carlos Anjos [email protected]

Aspect Oriented Programming (AOP) - A case study in Android

Embed Size (px)

Citation preview

Page 1: Aspect Oriented Programming (AOP) - A case study in Android

AOP

A case-study in Android

by

Carlos Anjos

[email protected]

Page 2: Aspect Oriented Programming (AOP) - A case study in Android

Why ?

Page 3: Aspect Oriented Programming (AOP) - A case study in Android

Developing for Android

● The 5 stages of grief● Denial

– “This can't be that bad, I must be missing something ...”● Anger

– “WTF did they have to reinvent the wheel … for the worse ?!”● Bargaining

– “Maybe I can find a port of my favorite framework for android … Err.... Maybe I can patch it to make it work ...”

● Depression– “Nothing works … nothing will ever work … :'-( Maybe I should stick to

doing HTML and Javascript ...“● Acceptance

– “Oh well … let's start coding !” - «Resistance is futile»

Page 4: Aspect Oriented Programming (AOP) - A case study in Android

Real men don't eat honey, they chew bees !

Page 5: Aspect Oriented Programming (AOP) - A case study in Android

What is AOP ?

Page 6: Aspect Oriented Programming (AOP) - A case study in Android

AspectJ

Page 7: Aspect Oriented Programming (AOP) - A case study in Android

AspectJ – Java AOP

● Cross-cutting concerns

Page 8: Aspect Oriented Programming (AOP) - A case study in Android

AOP - Weaving

Source: AspectJ in Action

Page 9: Aspect Oriented Programming (AOP) - A case study in Android

AOP – Like Themes

Page 10: Aspect Oriented Programming (AOP) - A case study in Android

Concepts

•Jointpoint

•Pointcut

•Advice

•Aspect

Page 11: Aspect Oriented Programming (AOP) - A case study in Android

How AspectJ implements AOP

Source code weavingBinary weaving

Load Time weaving

Page 12: Aspect Oriented Programming (AOP) - A case study in Android

How it works

Page 13: Aspect Oriented Programming (AOP) - A case study in Android

How it works

Page 14: Aspect Oriented Programming (AOP) - A case study in Android

How it works (with Android)

Page 15: Aspect Oriented Programming (AOP) - A case study in Android

The case study

Page 16: Aspect Oriented Programming (AOP) - A case study in Android

AspectJ FTW!

}

Page 17: Aspect Oriented Programming (AOP) - A case study in Android

AspectJ - Level 2

Page 18: Aspect Oriented Programming (AOP) - A case study in Android

AspectJ – Level 3

Page 19: Aspect Oriented Programming (AOP) - A case study in Android

AspectJ - Level 4

Page 20: Aspect Oriented Programming (AOP) - A case study in Android

AspectJ – Level 5

Page 21: Aspect Oriented Programming (AOP) - A case study in Android

AspectJ – Level 6

Page 22: Aspect Oriented Programming (AOP) - A case study in Android

AspectJ – Level 7

Page 23: Aspect Oriented Programming (AOP) - A case study in Android

AspectJ – Level 8

Page 24: Aspect Oriented Programming (AOP) - A case study in Android

AspectJ – Level 100

Page 25: Aspect Oriented Programming (AOP) - A case study in Android

AspectJ – Over 9000 !

Paradigm Shift !

Careful …

don't try to solve everything with aspects !

OOP is still good ! :-)

Page 26: Aspect Oriented Programming (AOP) - A case study in Android

“Perfection is achieved, not when there is nothing more to add,

but when there is nothing left to take away.”

Antoine de Saint-Exupéry

Page 27: Aspect Oriented Programming (AOP) - A case study in Android

Resources

● AspectJ in Action, Ramnivas Laddad● http://www.eclipse.org/aspectj/● http://www.eclipse.org/ajdt/● http://android.imeshine.com/

● stackoverflow.com

● commonsware.com● apps.sapo.pt● developer.android.com

Page 28: Aspect Oriented Programming (AOP) - A case study in Android

Questions ?