dynamic weaving for aspect- oriented programming fina… · dynamic weaving for aspect-oriented...

24
Dynamic weaving for aspect- oriented programming a 10 year perspective March 30 th 2012 Presentation in Modularity AOSD-2012, Potsdam Andrei Popovici, Thomas Gross, Gustavo Alonso

Upload: others

Post on 16-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

Dynamic weaving for aspect-

oriented programming

a 10 year perspective

March 30th 2012

Presentation in Modularity AOSD-2012, Potsdam

Andrei Popovici, Thomas Gross, Gustavo Alonso

Page 2: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

1

Contents

▪ Rationale for the 2002 paper

▪ The dynamic weaving approach

▪ The road ahead

Page 3: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

2

MOTIVATION: run-time adaptation (1/2)

CHALLENGES

▪ Debugging a network of

hundreds of sensors

▪ Developing software for

hundreds of deployment

configurations

▪ Make systems designed

as black / grey / white

boxes become more

adaptive

A B CHANGES

▪ Many devices beyond conventional

computers

– Wearable computing, sensor networks, etc.

– Application integration: in automotive,

enterprise architectures, etc.

▪ Increasing mobility

– Applications do not know in advance in

which context (car, home) they operate

– Range of mobility significantly increases

▪ Rapid changes in world economy – need

for more agility

– Unpredictable and rapid changes to global

production inputs (e.g., value chains, TTM)

– Need for faster and better integration

Page 4: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

3

The changes have rather amplified: why software needs to adapt?

10520-2-5-10<-20 >20

After 2005

2000-2005

Before 2000Probability steel price change

Monthly price change In percent

0

10

20

30

40

50

60

70

80

90

1990

1991

1992

1993

1994

1995

1996

1997

1998

1999

2000

2001

2002

2003

2004

2005

2006

2007

2008

2009

2010

2011

S&P 500 Volatility Index (1990-2011)

Old NormalAverage: 18.6

Stdev : 5.9

New NormalAverage: 22.0

Stdev : 9.4

600

500

400

300

200

1,100

1,000

900

800

700

06040220009896949290888684821980

100

0

+3% p.a.

201008

Geophysical events

Meteorological events

Hydrologic catastrophes

Climatic catastrophes

Value stream Non-economic

Macro/regulatory

Number of disruptive events

S&P 500 Volatility Index (1990-2011)

McKinsey & Company 6

Wo

rkin

g D

raft -

La

st Mo

difie

d 2

1/0

9/2

01

1 4

:45

:20

PM

Prin

ted

9/2

0/2

01

1 1

0:1

2:2

3 A

M

|

Global interconnectedness has a tendency to amplify and transmit these

local events

Sep 2008 – USA

Lehman Brothers filed

Ch.11 starting the global

economic crisis

April 2010 & May 2011

– Iceland

Volcanic eruption

stopped air traffic

Jan 2009 – Iceland

Government and banking

system collapsed

Jan 2009 – Russia

Shuts off all gas supplies

to Europe

Jan 2010 – China

FTA between Asian

nations removes tariffs

on 90% of goods

2009 – S.E. Asia

Ocean transportation

capacity shortage leads

to price spikes

Nov 2009 – Dubai

Economic crisis hit

the world economies

and major currencies

April 2010 – Greece

Major economic crisis

dramatically reduced the

value of Euro

Mar 2010 – Chile

Supply disruptions in

pulp cause prices to

reach near all-time-high

Jun 2009 – Honduras

Major political crisis

affected most

businesses

Feb 2010 – Haiti

Earthquake shutdown all

commercial activity

May 2010 - Gulf of Mexico

Major oil spill affected the

ocean traffic and seafood

industry

Mar 2011 – Japan

Major earthquake and

tsunami hurt all major

supply chains

Global interconnectness

A

Page 5: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

4

Postponing adaptation not only a software topic: used by

companies to be agile in responding to changes

▪ Inventories are held close to the customer allowing fast

response to changing demand

▪ By customizing later (e.g., specific packaging, language

instructions), products are kept in a standard, light form for

longer. Faster and more flexible transport options may

be used

▪ Delaying final customization ensures volume and mix

flexibility; the last differentiating steps occur after real

demand is known

▪ Products are differentiated as late as possible in the

value chain to allow responsiveness to actual demand,

rather than forecast demand

▪ Modularization can be used to create standard platforms

▪ Postponement can be used to allow late customization

▪ Variants can be removed completely through the design

of the product so that postponement is not needed

Dyeing is carried out

last so that customer

color preferences can

be satisfied

Bottles are labeled

according to live choice

at games and delivered

in <10 minutes giving

ultimate customization

Removes variants of

language instructions by

using pictographs

Segments customers

to trade-off against

configurability and short

lead times

Example Concept and solution

Result

A

Page 6: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

5

Audi A2 “…

personalize by

downloading soft-

ware activating

features such as

heated seats,

customized navi-

gation, or stiffer

suspension”

Adaptation is becoming more important as consumer electronics and

„software as a product‟ gain momentum

OEMs are starting to offer software as a

product in cars

▪ Upgradable, configurable vehicles

▪ Customized driver experiences

▪ Aftersales services (apps)

▪ New distribution channels

▪ New diagnosis and repair processes

1

Funktionen nachtanken? … jetzt bei Ihrem Volkswagen Partner

Software - Produktmanagement@Volkswagen EE

BMW: ConnectedDrive

VW: "tank up functionality"

Android-based apps

Consumer electronics are starting to converge

with cars

Connectivity

to CE devices

E-call/b-call1

such as OnStar/

BMW assist

Rear-seat

entertainment

Night vision

Satellite

radio

Mobile

navigation

Hands-free

telephony

Head-up

display

iPod con-

nectivity

Embedded

car navigation

PNDs

1 Emergency call/breakdown call

1

EXAMPLES

A

Page 7: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

6

MOTIVATION: run-time adaptation (2/2)

CHALLENGES

▪ Debugging a network of

hundreds of sensors

▪ Developing software for

hundreds of deployment

configurations

▪ Make systems designed

as black / grey / white

boxes become more

adaptive

A B CHANGES

▪ Many devices beyond conventional

computers

– Wearable computing, sensor networks, etc.

– Application integration: in automotive,

enterprise architectures, etc.

▪ Increasing mobility

– Applications do not know in advance in

which context (car, home) they operate

– Range of mobility significantly increases

▪ Rapid changes in world economy – need

for more agility

– Unpredictable and rapid changes to global

production inputs (e.g., value chains, TTM)

– Need for faster and better integration

Stop all of

them, de-

bug by

hand ?

Do not

try this at

home ...

Page 8: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

7

Ideal adaptation platform

We needed a generic adaptation

mechanism that …

▪ Supports run time adaptation

▪ Is independent of who drives the

adaptation process (the application

itself or the computing environment)

▪ Is independent of the adaptation and

the information needed to adapt

▪ Is small enough to be useful in mobile

settings

▪ Easily fits with existing developing

tools (no new languages, no new

developing techniques)

Adaptation paradigms

at the time

▪ Limited ability to

identify when to adapt

▪ The application is

responsible for

knowing how to adapt

▪ Limited ability to react

B

Page 9: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

8

Contents

▪ Rationale of the 2002 paper

▪ The dynamic weaving approach

▪ The road ahead

Page 10: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

9

PROSE had a dual scope

PROSE

(PROgrammable

Service

Extensions)

PROSE as platform

for adaptive

middleware

▪ As late as possible

“interception” mechanism of

the code execution (key in

middleware)

▪ High expressiveness of

describing adaptations

▪ Ability to work with multiple

devices at a time

PROSE as software

engineering project

▪ System for adaptation based

on aspect-orientation

▪ Dynamic (run-time)

weaving

▪ High flexibility in describing

and deploying aspects

Research scope Objective

More detail follows

Page 11: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

10

In a nut-shell, the system had five key traits …

JVM with mechanism

for execution

interception or

altering

Aspect Interface

of the JVM

Aspect-

Oriented

“System”

(Engine)

Application

thread

Aspects &

Advice to

execute

1

Application was not “aware” / prepared for aspects and advice execution 1

2

2 The first implementation of the JVM was using the debugger interface

3

3 The “aspect interface” was used to abstract from the actual interception

mechanism in the JVM (and survived 3 later JVM implementations)

4 The aspect engine was doing all the work

▪ When aspects were executed OR when they were woven into the JVM

4

5

5 Aspects and advice were all described in Java

Page 12: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

11

... and its design was „balanced‟ from the start towards

flexibility rather than performance

Expressiveness

Flexibility of

execution altering

/ interception

Performance

Ease of use (also

in distributed &

mobile settings)

High Low

Remarks

Subjective !

A

B

C

D

▪ Ability to capture a significant set of

joinpoints

– Less than compile-time

– Better than other dynamic systems

▪ “Late” decision on what advice to

execute (hence highly flexible) …

▪ … and inefficient compared to load-

time / compile-time approaches

▪ Later implementations improved

performance but decreased flexibility /

expressiveness

Area

▪ Aspects / and pointcuts were all Java

classes, hence they were “network-

friendly” (serialiazable, etc)

▪ Trying hard to resemble AspectJ

syntactics of aspects. Writing and

extending the “language” was quite

straightforward

Prose

Other (non-

compile-time) Score

Page 13: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

12

▪ Atomic weaving: in distributed settings, it is not enough

to adapt one application, one needs to adapt many in a

single logical step.

▪ Registraction, activation, and filtering of advices:

PROSE allows to include an advice without activating it,

activating it but filter its execution, and sophisticated

forms of filtering (at the AOP engine level)

▪ Advice querying, matching and similarity searches

on pools of distributed JVMs: for development and

debugging in large networks of devices

▪ Automatic leasing mechanism on extensions

(aspects)

▪ Security model and security checks on aspects

(signatures, sand boxing, authorization mechanisms)

▪ Complete API based design for added flexibility (add

your own AOP engine)

Flexibility of advice execution (late interception) and the ease-of-use made

PROSE a strong research platform for adaptive middleware

PROSE was

designed as

middleware for

adaptation

and, as such,

has

considered

many

problems that

other systems

were not

designed to

address

… but was this too powerful ?

Page 14: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

13

Contents

▪ Rationale of the 2002 paper

▪ The dynamic weaving approach

▪ The road ahead

Page 15: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

…today commonplace

▪ instrumentation

▪ verification

▪ state migration

▪ distribution

▪ adaptation

▪ updates

Key idea in PROSE: at the time controversial, today commonplace

14

At the time controversial …

▪ Key idea in PROSE:

Adaptation as a run time

software/systems

engineering technique

▪ the rest followed by being

consequent

▪ A recent example: Multiplicity

computing Cadar, Pietzuch, and

Wolf, FoSER 2010

Page 16: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

Since then, PROSE used in …

Databases

Systems

Software

Engineering

15

Angela Nicoara, Gustavo Alonso:

Making Applications Persistent at Run-time. ICDE 2007

Angela Nicoara, Gustavo Alonso, Timothy Roscoe:

Controlled, systematic, and efficient code replacement

for running java programs. EuroSys 2008

Susanne Cech Previtali, Thomas R. Gross:

Aspect-based dynamic software updating: a model

and its empirical evaluation. AOSD 2011

Page 17: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

Design & compile time vs. run time

PROSE:

• Dynamic = run time

• Aspect = adaptation / modification (not necessarily an orthogonal concern)

• PROSE = specialized JVM

TODAY:

▪ Increasing complexity in the underlying hardware

• Virtualization

• Clusters

• Cloud

• Mobile phones

16

▪ Can we adapt the deployment

of an application

▪ What should be the working

unit?

Page 18: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

OSGi Application (Service Perspective)

17

test.project.main

OSGi Framework with Service Registry

test.project.logging test.project.calculation

LogService CalculationService

Page 19: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

R-OSGi

18

test.project.main

OSGi Framework

test.project.logging test.project.calculation

LogService CalculationService

OSGi

Framework

OSGi

Framework

R-OSGi R-OSGi R-OSGi

Lo

gS

erv

iceP

roxy

Calc

Se

rvic

eP

roxy

Lo

gS

erv

ice

Calc

ula

tion

Se

rvic

e

Peer A Peer B Peer C

Page 20: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

R-OSGi

19

Example: Universal Remote Control

Tea Machine OSGi Service

R-OSGi Service UI

Page 21: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

AlfredO: Flexible

multi-tier

architecture

20

Page 22: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

Mouse Controller application

21

Page 23: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

Cirrostratus

22

+ implicit requirements

+ non-functional requirements

Page 24: Dynamic weaving for aspect- oriented programming FINA… · Dynamic weaving for aspect-oriented programming a 10 year perspective March 30th 2012 Presentation in Modularity AOSD-2012,

Conclusions

Run time

software/systems

engineering

(Dynamic) Aspect

oriented

programming a key

technique

23

Still many open, interesting questions

▪ too powerful?

▪ too difficult?

▪ a systems technique?

▪ a developer technique?

▪ working units? => the module?

Great prospects for the future

▪ very many application scenarios