ingeniería del soware ii - unican.es · 2017-06-13 · aspect-oriented programming aspect-oriented...

51
Seminario. Programación Orientada a Aspectos Ingeniería del So8ware II Pablo Sánchez Barreiro DPTO. DE MATEMÁTICAS,ESTADÍSTICA Y COMPUTACIÓN [email protected] Este tema se publica bajo Licencia: CreaNve Commons BY‐NC‐SA 3.0

Upload: others

Post on 09-Aug-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Seminario.ProgramaciónOrientadaaAspectos

IngenieríadelSo8wareII

PabloSánchezBarreiroDPTO.DEMATEMÁTICAS,ESTADÍSTICAY

COMPUTACIÓN

[email protected]

EstetemasepublicabajoLicencia:CreaNveCommonsBY‐NC‐SA3.0

Page 2: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Table of Contents

1 Introduction: Why we need Aspect-Oriented Programming

2 Aspect-Oriented Programming

3 Current Challenges

4 What AOSD Is Not About

5 AOSD and Related Technologies

6 Conclusions

7 References

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 2 / 51

Page 3: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Introduction Crosscutting Concerns

Crosscutting Concerns Drawbacks

Happiness

Sadness

M o dul e A M o dul e E Module D M o dul e C M o dul e B

Base Functionality

Fault Tolerance v 2 . 0

Access Control

Encryption

@#& �

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 3 / 51

Page 4: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Introduction Crosscutting Concerns

Case Study: Apache Tomcat

XML parsing

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 4 / 51

Page 5: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Introduction Crosscutting Concerns

Case Study: Apache Tomcat

URL pattern matching

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 5 / 51

Page 6: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Introduction Crosscutting Concerns

Case Study: Apache Tomcat

Logging

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 6 / 51

Page 7: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Introduction Crosscutting Concerns

Motivating example: Access Control

AccessControlclass [ ]

+askForCredentials( out username : String, out password : String )

AccessControlView

+getAccess() : Boolean+getSelectiveAccess( String : String )

AccessControl

-name : String-address : String-religion : String-diseases : String [0..*]

+getName() : String+getAddress() : String+getReligion() : String+getDiseases() : String [0..*]

Student +authenticator

«use»

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 7 / 51

Page 8: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Introduction Crosscutting Concerns

Motivating example: Access Control

public class Student {

protected String religion;

protected AccessControl authenticator =

new AccessControl();

public String getReligion() {

String result = null;

if (authenticator.getAccess()) {

result = this.religion;

} // if

return result;

} // getReligion

} // Student

public class Student {

protected String religion;

protected AccessControl authenticator =

new AccessControl();

public String getReligion() {

String result = null;

if (authenticator.getAccess()) {

result = this.religion;

} // if

return result;

} // getReligion

} // Student

Crosscutting code

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 8 / 51

Page 9: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Introduction Crosscutting Concerns

Motivating example: Access Control

public List<String> getDiseases() {

List<String> result = null;

if (authenticator.getAccess()) {

result = this.diseases;

} // if

return result;

} // getDiseases

Crosscutting code

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 9 / 51

Page 10: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Introduction Crosscutting Concerns

Main Shortcoming of Crosscutting Concerns

Happiness

Sadness

M o dul e A M o dul e E Module D M o dul e C M o dul e B

Base Functionality

Fault Tolerance v 2 . 0

Access Control

Encryption

@#& �

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 10 / 51

Page 11: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Introduction Conclusions

Conclusions

Scattering

A concern appears spread over several software modules.

Tangling

Several concern appears software modules.

1 Scattering: Decreases encapsulation, (consequently decreasescohesion), creates redundancies, hinders reutilization of thecrosscutting concern and increase coupling.

2 Tangling: Decreases cohesion, (consequently hampers reutilization),and increases coupling.

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 11 / 51

Page 12: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Introduction Empirical Evidence

Concern-Oriented Metrics [Sant’Anna et al., 2007]

CDC Concern Diffusion over Classes

CDO Concern Diffusion over Operations

CIC Class-Level Interlacing between Concerns

OOC Operation-Level Overlapping between Concerns

ACC Afferent Coupling between Classes

ECC Efferent Coupling between Classes

LCC Lack of Concern-Based Cohesion

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 12 / 51

Page 13: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Introduction Empirical Evidence

Concern-Oriented Metrics [Sant’Anna et al., 2007]

AccessControlclass [ ]

+askForCredentials( out username : String, out password : String )

AccessControlView

+getAccess() : Boolean+getSelectiveAccess( String : String )

AccessControl

-name : String-address : String-religion : String-diseases : String [0..*]

+getName() : String+getAddress() : String+getReligion() : String+getDiseases() : String [0..*]

Student +authenticator

«use»

CDC CDO CIC OOC

Data Storage (base) 1 4 1 1

AccessControl 3 5 1 1

ACC ECC LCC

Student 0 1 2

AccessControl 1 1 1

AccessControlView 1 0 1

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 13 / 51

Page 14: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming

Table of Contents

1 Introduction: Why we need Aspect-Oriented Programming

2 Aspect-Oriented Programming

3 Current Challenges

4 What AOSD Is Not About

5 AOSD and Related Technologies

6 Conclusions

7 References

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 14 / 51

Page 15: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Overview

Aspect-Oriented Programming Principle

Module B

Module A

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 15 / 51

Page 16: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Overview

Aspect-Oriented Programming Principle

Module B

Module A

Joinpoint

Joinpoint

Joinpoint

Joinpoint

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 16 / 51

Page 17: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Overview

Aspect-Oriented Programming Principle

Access Control

Module B

Module A

Fault Tolerance

Encryption

Aspect

Aspect

Aspect

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 17 / 51

Page 18: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Overview

Aspect-Oriented Programming Principle

Access Control

Module B

Module A

Fault Tolerance

Encryption

Pointcut

Pointcut

Pointcut

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 18 / 51

Page 19: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Aspect-Oriented Weaving

Weaving Process

Base Model

Aspect-Oriented Weaving Process

Asp

ect

We

ave

rPointcut Model

Aspect Model

Woven Base Model

Co

mm

on

Co

mp

ile

r

100101

101100

010101

Compiled Code

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 19 / 51

Page 20: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Aspect-Oriented Weaving

Weaving Process

ConcernIdentifier

Requirements

Weaver

Concernimplementation

AspectualDecomposition

AspectualRecomposition

Final System

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 20 / 51

Page 21: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Aspect-Oriented Weaving

Kinds of Aspect-Oriented Weaving

Static Weaving Aspects are woven at compile time [Kiczales et al., 2001].

Load-Time Weaving Aspects are woven at classload-time [Laddad, 2001, Chiba, 2000].

Dynamic Weaving Aspects can be woven and even unwoven atruntime [Pinto et al., 2005, Suvee et al., 2003]. It isparticulary interesting for context-awaresystems [Fuentes et al., 2009].

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 21 / 51

Page 22: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Example: Access Control as an Aspect

Access Control With AspectJ

public aspect AccessControlAspect {

pointcut guardedMethods():

call(String Student.getReligion());

String around() : guardedMethods() {

AccessControl guard = new AccessControl();

String returnValue = null;

if (guard.getAccess()) {

returnValue = proceed();

} // if

return returnValue;

} // around guardedMethods

} // AccessControlAspect

public aspect AccessControlAspect {

pointcut guardedMethods():

call(String Student.getReligion());

String around() : guardedMethods() {

AccessControl guard = new AccessControl();

String returnValue = null;

if (guard.getAccess()) {

returnValue = proceed();

} // if

return returnValue;

} // around guardedMethods

} // AccessControlAspect

public aspect AccessControlAspect {

pointcut guardedMethods():

call(String Student.getReligion());

String around() : guardedMethods() {

AccessControl guard = new AccessControl();

String returnValue = null;

if (guard.getAccess()) {

returnValue = proceed();

} // if

return returnValue;

} // around guardedMethods

} // AccessControlAspect

public aspect AccessControlAspect {

pointcut guardedMethods():

call(String Student.getReligion());

String around() : guardedMethods() {

AccessControl guard = new AccessControl();

String returnValue = null;

if (guard.getAccess()) {

returnValue = proceed();

} // if

return returnValue;

} // around guardedMethods

} // AccessControlAspect

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 22 / 51

Page 23: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Example: Access Control as an Aspect

A Clean Student Class

public class Student {

protected String religion;

public String getReligion() {

return this.religion;

} // getReligion

} // Student

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 23 / 51

Page 24: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Quantification

Wildcard-based Quantified Pointcuts

public aspect QuantifiedAccessControlAspect {

pointcut guardedMethods(): call(* Student.get*(..));

Object around() : guardedMethods() {

AccessControl guard = new AccessControl();

Object returnValue = null;

if (guard.getAccess()) {

returnValue = proceed();

} // if

return returnValue;

} // around guardedMethods

} // QuantifiedAccessControlAspect

public aspect QuantifiedAccessControlAspect {

pointcut guardedMethods(): call(* Student.get*(..));

Object around() : guardedMethods() {

AccessControl guard = new AccessControl();

Object returnValue = null;

if (guard.getAccess()) {

returnValue = proceed();

} // if

return returnValue;

} // around guardedMethods

} // QuantifiedAccessControlAspect

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 24 / 51

Page 25: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Annotation-based Quantification

Annotation-based Quantified Pointcuts

public class Student {

protected String religion;

@AccessControlRequired

public String getReligion() {

return this.religion;

} // getReligion

} // Student

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 25 / 51

Page 26: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Annotation-based Quantification

Annotation-based Quantified Pointcuts

public aspect AnnotationBasedAspect {

pointcut guardedMethods():

call(@AccessControlRequired * *.*(..));

Object around() : guardedMethods() {

AccessControl guard = new AccessControl();

Object returnValue = null;

if (guard.getAccess()) {

returnValue = proceed();

} // if

return returnValue;

} // around guardedMethods

} // AnnotationBasedAspect

public aspect AnnotationBasedAspect {

pointcut guardedMethods():

call(@AccessControlRequired * *.*(..));

Object around() : guardedMethods() {

AccessControl guard = new AccessControl();

Object returnValue = null;

if (guard.getAccess()) {

returnValue = proceed();

} // if

return returnValue;

} // around guardedMethods

} // AnnotationBasedAspect

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 26 / 51

Page 27: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Reflection

Some Basic & Free Reflection

A c c e s s C o n t r o lc l a s s [ ]

+ a s k F o r C r e d e n t i a l s ( o u t u s e r n a m e : S t r i n g , o u t p a s s w o r d : S t r i n g )

A c c e s s C o n t r o l V i e w

+ g e t A c c e s s ( ) : B o o l e a n+ g e t S e l e c t i v e A c c e s s ( S t r i n g : S t r i n g )

A c c e s s C o n t r o l

- n a m e : S t r i n g- a d d r e s s : S t r i n g- r e l i g i o n : S t r i n g- d i s e a s e s : S t r i n g [ 0 . . * ]

+ g e t N a m e ( ) : S t r i n g+ g e t A d d r e s s ( ) : S t r i n g+ g e t R e l i g i o n ( ) : S t r i n g+ g e t D i s e a s e s ( ) : S t r i n g [ 0 . . * ]

S t u d e n t + a u t h e n t i c a t o r

« u s e »

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 27 / 51

Page 28: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Reflection

Some Basic & Free Reflection

public aspect ReflectionAccessControlAspect {

pointcut guardedMethods():

call(String Student.getReligion());

String around() : guardedMethods() {

AccessControl guard = new AccessControl();

String returnValue = null;

if (guard.getSelectiveAccess(

thisJoinPoint.getSignature().

getName())) {

returnValue = proceed();

} // if

return returnValue;

} // around guardedMethods

} // ReflectionAccessControlAspect

public aspect ReflectionAccessControlAspect {

pointcut guardedMethods():

call(String Student.getReligion());

String around() : guardedMethods() {

AccessControl guard = new AccessControl();

String returnValue = null;

if (guard.getSelectiveAccess(

thisJoinPoint.getSignature().

getName())) {

returnValue = proceed();

} // if

return returnValue;

} // around guardedMethods

} // ReflectionAccessControlAspect

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 28 / 51

Page 29: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Aspect-Oriented Programming Reflection

Concern-Oriented Metrics RevisitedAccessControlAspectclass [ ]

+askForCredentials( out username : String, out password : String )

AccessControlView

-name : String-address : String-religion : String-diseases : String [0..*]

+getReligion() : String+getName() : String+getAddress() : String+getDiseases( diseases : String [0..*] )

Student

+getAccess() : Boolean+getSelectiveAccess( String : String )

AccessControl

«crosscut»

CDC CDO CIC OOC

Data Storage (base) 1 (1) 4 (4) 0 (1) 0 (1)

AccessControl 2 (2) 3 (5) 0 (1) 0 (1)

ACC ECC LCC

Student 1 (0) 0 (1) 1 (2)

AccessControl 0 (1) 2 (1) 1 (1)

AccessControlView 1 (1) 0 (0) 1 (1)

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 29 / 51

Page 30: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Current Challenges

Table of Contents

1 Introduction: Why we need Aspect-Oriented Programming

2 Aspect-Oriented Programming

3 Current Challenges

4 What AOSD Is Not About

5 AOSD and Related Technologies

6 Conclusions

7 References

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 30 / 51

Page 31: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Current Challenges

Current Hot Research Topics on AOSD

1 Semantic pointcuts [Ostermann et al., 2005].

2 Reusable aspects (e.g Complex TransactionManagement) [Kienzle and Gelineau, 2006].

3 Aspect interference/conflicts [Douence et al., 2002,Douence et al., 2004, Altahat et al., 2008].

4 Complex pointcuts [Allan et al., 2005].

5 Aspect Influence on Interfaces [Ostermann, 2008].

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 31 / 51

Page 32: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Current Challenges

Current Hot Research Topics on AOSD

<<CallBehavior>> calculateDiscount

<<CallBehavior>> minus

first

proceed <<proceed>>

price

price : Real

checkOut(..)

(.*):(.*) <?cart>(.*) : ShoppingCart

(.*):(.*)

newCreditCard(..)

<?ws>(.*): WebServiceBank

termsAndConditionsOfSeasonalRebate

[*]

<?jp>: appr oveCredit(<?cc>(.*):PaymentMethod, <?price>(.*):Real))

<?cc>(.*):CreditCard

?jp ?price

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 32 / 51

Page 33: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

What AOSD is not about

Table of Contents

1 Introduction: Why we need Aspect-Oriented Programming

2 Aspect-Oriented Programming

3 Current Challenges

4 What AOSD Is Not about

5 AOSD and Related Technologies

6 Conclusions

7 References

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 33 / 51

Page 34: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

What AOSD is not about AOSD is not View-Based Software Development

AOSD is not View-Based Software Development

class addItem

UserGUI ShoppingCartIShop

+ books

0..*

+addItem (book :Book , amount :int )

<< theme >>

AddItem<< theme >>

CheckOut

class checkOut

UserGUI ShoppingCartIShop

Delivery

+ checkOut ()

IDelivery

Bank

IBank

sd checkOut

UserGUI ShoppingCart Delivery Bank

checkDelivery (address =-,weight =-,size =-)

approveCredit (ccNumber =-,amount =-)

merge

Books

sd addItem

UserGUI ShoppingCart

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 34 / 51

Page 35: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

What AOSD is not about AOSD is not Feature-Oriented Software Development

AOSD is not Feature-Oriented Software Development

Architectureclass [ ]

SmartEnergyMng

+openWindow( id : Integer )+closeWindow( id : Integer )+adjustTemperature( id : Integer, temp : float )

Gateway

+operationMode : TempUnits

ThermometerCtrl Sensor

InitialModel

+changeValue( id : Integer, value : float )+emergence( a : Sensor, value : float )

Gateway

+id : Integer

+setValue( value : float )

Actuator

+id : Integer

+getValue() : float

Sensor

HeaterMng

+adjustTemperature( id : Integer, temp : float )

Gateway

+units : TempUnits

+set( t : float )

HeaterCtrl

FAHRENHEITCELSIUS

«enumeration»

TempUnits

Actuator

WindowMng

+openWindow( id : Integer )+closeWindow( id : Integer )

Gateway

+open()+close()

WindowCtrl Actuator

LightMng

+switchLight( id : Integer )

Gateway

+switch()

LightCtrl

Actuator

+indoorTherm

1

+outdoorTherm

1

+sensors

0..*+actuators

0..* +gtw

0..1

+heaters

1..*

+windows

1..*

+lights

1..*

«merge»

«merge»

«merge»«merge»

«merge»

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 35 / 51

Page 36: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

AOSD and Related Technology

Table of Contents

1 Introduction: Why we need Aspect-Oriented Programming

2 Aspect-Oriented Programming

3 Current Challenges

4 What AOSD Is Not About

5 AOSD and Related Technologies

6 Conclusions

7 References

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 36 / 51

Page 37: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

AOSD and Related Technology

AOSD and Related Technology

1 Component platforms/Application Servers/ContainerTechnology

◮ Component platforms offer a set of fixed services.◮ Configuration of each service is often different.◮ Component platforms are often heavier.

2 Reflection: AOP is reflection for human beings.

3 Design Patterns, Dynamic Proxies: The aspect-oriented weaverdoes it for you.

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 37 / 51

Page 38: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

AOSD and Related Technology

AOSD in Industry

1 Spring framework for Enterprise Java.

2 SpringSource dm Server, SpringSource tc Server, Spring Roo yMagma.

3 GlassBox, Perf4J, Contract4J, JXInsight, MaintainJ.

4 Websphere, MySQL, JBoss, Oracle Toplink,J2ME [Rashid et al., 2010].

5 Siemens Healthcare [Rashid et al., 2010].

6 Motorola Weavr [Cottenier et al., 2007].

7 Oficina Virtual Fundacion Retevision [Pinto et al., 2005]

8 Digital Publishing [de Beeck et al., 2009].

9 Isis Project (Stop Pedophilia).

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 38 / 51

Page 39: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Conclusions

Table of Contents

1 Introduction: Why we need Aspect-Oriented Programming

2 Aspect-Oriented Programming

3 Current Challenges

4 What AOSD Is Not About

5 AOSD and Related Technologies

6 Conclusions

7 References

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 39 / 51

Page 40: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Conclusions

Conclusions

Aspect-Oriented Software Development

Aspect-Oriented Software Development can help to improvemodularization of crosscutting concerns, easing maintenance and evolution.

Access Control Code:http://personales.unican.es/sanchezbp/teaching/ao/accesscontrol.zip

More Information:http://www.aosd-europe.net

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 40 / 51

Page 41: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

References

Table of Contents

1 Introduction: Why we need Aspect-Oriented Programming

2 Aspect-Oriented Programming

3 Current Challenges

4 What AOSD Is Not About

5 AOSD and Related Technologies

6 Conclusions

7 References

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 41 / 51

Page 42: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

References

Referencias I

Allan, C., Avgustinov, P., Christensen, A. S., Hendren, L. J., Kuzins,S., Lhotak, O., de Moor, O., Sereni, D., Sittampalam, G., and Tibble,J. (2005).Adding trace matching with free variables to AspectJ.In Johnson, R. E. and Gabriel, R. P., editors, Proc. of the 20th AnnualConference on Object-Oriented Programming, Systems, Languages,and Applications, (OOPSLA), pages 345–364.

Altahat, Z., Elrad, T., and Tahat, L. (2008).Applying Critical Pair Analysis in Graph Transformation Systems toDetect Syntactic Aspect Interaction in UML State Diagrams.In Proc. of the 20th Int. Conference on Software Engineering &Knowledge Engineering (SEKE), pages 905–911, San Francisco(California, USA).

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 42 / 51

Page 43: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

References

Referencias II

Brichau, J. and D‘Hondt, T. (2005).Introduction to Aspect-Oriented Software Development.Deliverable D17 AOSD-Europe-VUB-02, AOSD-Europe Network ofExcellence, Brussels.

Chiba, S. (2000).Load-Time Structural Reflection in Java.In Bertino, E., editor, Proc. of the 14th European Conference onObject-Oriented Programming (ECOOP), pages 313–336, SophiaAntipolis and Cannes (France).

Colyer, A., Clement, A., Harley, G., and Webster, M. (2004).Eclipse AspectJ: Aspect-Oriented Programming with AspectJ and theEclipse AspectJ Development Tools.Addison-Wesley Professional.

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 43 / 51

Page 44: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

References

Referencias III

Cottenier, T., van den Berg, A., and Elrad, T. (2007).Motorola WEAVR: Aspect and model-Driven Engineering.Journal of Object Technology (JOT), 6(7):51–88.

de Beeck, S. O., Landuyt, D. V., Truyen, E., and Joosen, W. (2009).Building a Next-Generation Digital News Publishing Platform withAOSD.In Proc. of the 8th Int. Conference on Aspect-Oriented SoftwareDevelopment (AOSD), Charlottesvile (Virginia, USA).Demostration.

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 44 / 51

Page 45: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

References

Referencias IV

Douence, R., Fradet, P., and Sudholt, M. (2002).A Framework for the Detection and Resolution of Aspect Interactions.In Batory, D. S., Consel, C., and Taha, W., editors, Proc. of the Int.Conference on Generative Programming and Component Engineering(GPCE), volume 2487 of LNCS, pages 173–188, Pittsburgh,(Pennsylvania, USA).

Douence, R., Fradet, P., and Sudholt, M. (2004).Composition, Reuse and Interaction Analysis of Stateful Aspects.In Proc. of the 3rd Int. Conference on Aspect-Oriented SoftwareDevelopment (AOSD), pages 141–150, Lancaster (UK).

Elrad, T., Aksit, M., Kiczales, G., Lieberherr, K., and Ossher, H.(2001).Discussing Aspects of AOP.Communications of the ACM, 44(10):33–38.

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 45 / 51

Page 46: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

References

Referencias V

Filman, R. E., Elrad, T., Clarke, S., and Aksit, M., editors (2004).Aspect-Oriented Software Development.Addison-Wesley, Boston.

Fuentes, L., Gamez, N., and Sanchez, P. (2009).Aspect-Oriented Design and Implementation of Context-AwarePervasive Applications.Innovations in Systems and Software Engineering, 5(1):79–93.

Hannemann, J. and Kiczales, G. (2002).Design Pattern Implementation in Java and AspectJ.In Proc. of the 17th Int. Conference on Object-OrientedProgramming, Systems, Languages, and Applications (OOPSLA),pages 161–173, Seattle (Washington, USA).

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 46 / 51

Page 47: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

References

Referencias VI

Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., andGriswold, W. G. (2001).An Overview of AspectJ.In Knudsen, J. L., editor, Proc. of the 15th European Conference onObject-Oriented Programming (ECOOP), volume 2072 of LectureNotes in Computer Science, pages 327–353, Budapest (Hungary).

Kiczales, G., Lamping, J., Mendhekar, A., Maeda, C., Lopes, C. V.,Loingtier, J.-M., and Irwin, J. (1997).Aspect-Oriented Programming.In Aksit, M. and Matsuoka, S., editors, Proc. of the 11th EuropeanConference on Object-Oriented Programming (ECOOP), volume 1241of Lecture Notes in Computer Science, pages 220–242,Jyvaskyla (Finland).

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 47 / 51

Page 48: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

References

Referencias VII

Kienzle, J. and Gelineau, S. (2006).AO challenge - Implementing the ACID properties for TransactionalObjects.In Filman, R. E., editor, Proc. of the 5th Int. Conference onAspect-Oriented Software Development (AOSD), pages 202–213.

Laddad, R. (2001).I want my AOP!Java World,http://www.javaworld.com/javaworld/jw-01-2002/jw-0118-aspe

Ostermann, K. (2008).Reasoning about Aspects with Common Sense.In D’Hondt, T., editor, Proc. of the 7th Int. Conference onAspect-Oriented Software Development (AOSD), pages 48–59,Brussels (Belgium).

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 48 / 51

Page 49: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

References

Referencias VIII

Ostermann, K., Mezini, M., and Bockisch, C. (2005).Expressive Pointcuts for Increased Modularity.In Black, A. P., editor, Proc. of the 19th European Conference onObject-Oriented Programming (ECOOP), volume 3586 of LNCS,pages 214–240, Glasgow (UK).

Pinto, M., Fuentes, L., and Troya, J. M. (2005).A Dynamic Component and Aspect-Oriented Platform.Computer Journal, 48(4):401–420.

Rashid, A., Cottenier, T., Greenwood, P., Chitchyan, R., Meunier, R.,Coelho, R., Sudholt, M., and Joosen, W. (2010).Aspect-Oriented Software Development in Practice: Tales fromAOSD-Europe.IEEE Computer, 43(2):19–26.

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 49 / 51

Page 50: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

References

Referencias IX

Sant’Anna, C., Figueiredo, E., Garcia, A. F., and de Lucena, C. J. P.(2007).On the Modularity of Software Architectures: A Concern-DrivenMeasurement Framework.In Oquendo, F., editor, Proc. of the 1st European Conference onSoftware Architecture (ECSA), pages 207–224, Aranjuez (Spain).

Suvee, D., Vanderperren, W., and Jonckers, V. (2003).JAsCo: an Aspect-Oriented Approach Tailored for Component-BasedSoftware Development.In Proc. of the 2nd Int. Conference on Aspect-Oriented SoftwareDevelopment (AOSD), pages 21–29, Boston (Massachusetts, USA).

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 50 / 51

Page 51: Ingeniería del Soware II - unican.es · 2017-06-13 · Aspect-Oriented Programming Aspect-Oriented Weaving Kinds of Aspect-Oriented Weaving Static Weaving Aspects are woven at compile

Questions

Questions ?

Pablo Sanchez (MATESCO) Aspect-Oriented Programming 51 / 51