Are Pointcuts a First-Class Language Construct? Einfhrung Teil 1 - - PowerPoint PPT Presentation

are pointcuts a first class language construct
SMART_READER_LITE
LIVE PREVIEW

Are Pointcuts a First-Class Language Construct? Einfhrung Teil 1 - - PowerPoint PPT Presentation

Are Pointcuts a First-Class Language Construct? Einfhrung Teil 1 Stephan Herrmann Technische Universitt Berlin stephan@cs.tu-berlin.de www.ObjectTeams.org FOAL'06 Stephan Herrmann #1 Join Points? program element A join point is a


slide-1
SLIDE 1

FOAL'06 Stephan Herrmann #1

Are Pointcuts a First-Class Language Construct?

Einführung Teil 1 Stephan Herrmann Technische Universität Berlin

stephan@cs.tu-berlin.de www.ObjectTeams.org

slide-2
SLIDE 2

FOAL'06 Stephan Herrmann #2

Join Points?

„A join point is a point of interest in some artefact ... through which two or more concerns may be composed“ [Crosscut 1st Issue] „A join point is a point in the execution of a program ...“

program element runtime event

slide-3
SLIDE 3

FOAL'06 Stephan Herrmann #3

A Calculus for Pointcut Composition?

  • &&, || and ! ≠ ∧, ∨ and ¬

– distributive law does not hold in AspectJ

  • event negation?

– debatable semantics

  • intersection of join point kinds?

– call(T C.foo()) && set(T C.bar) ??

slide-4
SLIDE 4

FOAL'06 Stephan Herrmann #4

Outline

  • Minimal AOP w/o „pointcut“

– Bottom-up construction of AOP

  • economy of concepts – „pointcut“ is an expensive concept

– Terminology of „Join Point Interception“ – Meta model for join points

  • The Delta
  • „Pointcuts“

– Reverse methods – Model: pointcuts as classes – Compositionality for free

slide-5
SLIDE 5

FOAL'06 Stephan Herrmann #5

Minimal AOP

  • Join points

– elements of the program, defined by meta model

  • Join point queries

– matching (wildcards etc.) ∨ functional queries

  • kind & scope & constraint
  • Join point interception

– binding: aspect method ← set of join points

  • before | after | replace
  • possibly guarded (run-time filter)
  • overridable (needs a name)

– execution of join point may trigger aspect method

advice

>

E(C)/A

slide-6
SLIDE 6

FOAL'06 Stephan Herrmann #6

Discussion

  • Powerful AOP without

„points in the execution of a program“

– amenable to formal, static analysis – students can implement/understand the language

  • What is missing?

– Regarding AspectJ:

  • cflow

– Other dynamic approaches

  • stateful aspects
  • trace matches
  • ...

– What do these have in common?

consume multiple events to trigger one action

slide-7
SLIDE 7

FOAL'06 Stephan Herrmann #7

Reverse Methods

  • Definition by Anti-Symmetry:

m()

m2() m3() mx()

m2() m3()

<client>

jp3 PC

trig2() trig3() trigx()

<advice>

consume one incoming call event produce sequence of outgoing events produce one outgoing call event consume sequence of incoming events

Method Pointcut

return proceed jp2

slide-8
SLIDE 8

FOAL'06 Stephan Herrmann #8

Pointcut Class

  • Why invent something new?

– public team class T {

protected class R playedBy ? { void rm() { ... } rm <- replace PC1.fire; } }

R rm rm <- PC1 PC1 fire m2() {....} m3 m2 <- PC2 m3 <- B.m

slide-9
SLIDE 9

FOAL'06 Stephan Herrmann #9

Compositional Pointcut Binding

  • Why invent something new?

– public team class T {

protected class R playedBy ? { void rm() { ... } rm <- replace PC1.fire; } }

R rm rm <- PC1 PC1 fire m2() {....} m3 m2 <- PC2 m3 <- B.m PC2 m4 m5 fire m4 <- bm1 m5 <- query2() B rm

slide-10
SLIDE 10

FOAL'06 Stephan Herrmann #10

Economy

  • Join point interception

– a low-cost concept – statically determined

  • Multi-event triggers

– generalized/simulated by class – specialized syntax deferred

  • Calculi

– join points: functional queries (meta model + set theory) – aspect binding: E(C)/A + overriding – composition as aspects-of-aspects

more details at: www.objectteams.org/publications