Using Aspects for Language Portability Lennart Kats Eelco Visser - - PowerPoint PPT Presentation

using aspects for language portability
SMART_READER_LITE
LIVE PREVIEW

Using Aspects for Language Portability Lennart Kats Eelco Visser - - PowerPoint PPT Presentation

Using Aspects for Language Portability Lennart Kats Eelco Visser DSLs Stratego SDF Spoofax DSL compilers (code generators) DSL Generator Backend targets the platform DSL Frontend Backend Backend targets the platform s DSL


slide-1
SLIDE 1

Using Aspects for Language Portability

Eelco Visser Lennart Kats

slide-2
SLIDE 2

DSLs Stratego SDF Spoofax

slide-3
SLIDE 3

DSL compilers (code generators)

Generator

DSL

slide-4
SLIDE 4

Frontend Backend

DSL

Backend targets the platform

slide-5
SLIDE 5

DSL

Frontend Backend

s

Backend Backend

Backend targets the platform

slide-6
SLIDE 6

“So switching to another platform is just a little matter of switching the backend, right?”

(wrong)

slide-7
SLIDE 7

Why not?

  • platform-exclusive libraries
  • platform escapes and native calls
  • interoperability and integration with

platform applications

  • performance and stack behavior
slide-8
SLIDE 8

Then what?

Use aspect weaving to address portability issues in programs and libraries!

slide-9
SLIDE 9

Frontend Backend Backend

Our case study

Stratego/XT

C/POSIX

slide-10
SLIDE 10

(spoofax.org)

Why Java?

slide-11
SLIDE 11

Primitives Platform libs Backend

Architecture

Standard libs Programs Frontend Backend Primitives Platform libs Portability aspects

slide-12
SLIDE 12
  • 1. Glue code aspects

Override functions and library invocations to work with platform-specific libraries

  • SGLR vs. JSGLR
  • ORM
  • communication
  • etc.
slide-13
SLIDE 13
  • 2. Migration aspects

Because we cannot solve all portability problems (right away)

  • There may be no alternative for a library
  • Primitives may make assumptions about

the platform (e.g., POSIX vs. Java)

slide-14
SLIDE 14
  • 2. Migration aspects

Warn developers about unportable code Perform “next best” operation

slide-15
SLIDE 15
  • 3. Integration aspects

Enhance platform integration:

  • error handling (exceptions, console vs. GUI)
  • logging
  • hooks
  • user interaction (console vs. GUI vs. web)
slide-16
SLIDE 16
  • 4. Optimization aspects

Address platform performance issues of... ...expensive operations ...common operations (bottlenecks) by using platform-specific code

  • r by using code more suited for the platform
slide-17
SLIDE 17

Summary

Many additional portability issues

  • replacing the backend is not enough!

AOP elegantly addresses them

  • four classes of portability aspects
  • encapsulate platform concerns in

separate libraries