using aspects for language portability
play

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


  1. Using Aspects for Language Portability Lennart Kats Eelco Visser

  2. DSLs Stratego SDF Spoofax

  3. DSL compilers (code generators) DSL Generator

  4. Backend targets the platform DSL Frontend Backend

  5. Backend targets the platform s DSL Frontend Backend Backend Backend

  6. “So switching to another platform is just a little matter of switching the backend, right?” (wrong)

  7. Why not? • platform-exclusive libraries • platform escapes and native calls • interoperability and integration with platform applications • performance and stack behavior

  8. Then what? Use aspect weaving to address portability issues in programs and libraries!

  9. Our case study C/POSIX Frontend Backend Stratego/XT Backend

  10. Why Java? (spoofax.org)

  11. Architecture Frontend Standard libs Primitives Primitives Backend Backend Programs Platform libs Platform libs Portability aspects

  12. 1. Glue code aspects Override functions and library invocations to work with platform-specific libraries • SGLR vs. JSGLR • ORM • communication • etc.

  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)

  14. 2. Migration aspects Warn developers about unportable code Perform “next best” operation

  15. 3. Integration aspects Enhance platform integration: • error handling (exceptions, console vs. GUI) • logging • hooks • user interaction (console vs. GUI vs. web)

  16. 4. Optimization aspects Address platform performance issues of... ...expensive operations ...common operations (bottlenecks) by using platform-specific code or by using code more suited for the platform

  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

Recommend


More recommend