using aspects for language portability (scam 2010)
TRANSCRIPT
![Page 1: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/1.jpg)
Using Aspects for Language Portability
Eelco VisserLennart Kats
![Page 2: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/2.jpg)
![Page 3: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/3.jpg)
DSLs
Stratego
SDF
Spoofax
![Page 4: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/4.jpg)
DSL compilers(code generators)
GeneratorDSL
![Page 5: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/5.jpg)
Frontend BackendDSL
Backend targets the platform
![Page 6: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/6.jpg)
DSL Frontend Backend
s
Backend
Backend
Backend targets the platform
![Page 7: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/7.jpg)
“So switching to another platform is just a little
matter of switching the backend, right?”
(wrong)
![Page 8: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/8.jpg)
Why not?
•platform-exclusive libraries
•platform escapes and native calls
•interoperability and integration with platform applications
•performance and stack behavior
![Page 9: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/9.jpg)
Then what?
Use aspect weaving to address portability issues in programs and libraries!
![Page 10: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/10.jpg)
Frontend Backend
Our case study
Stratego/XT
C/POSIX
![Page 11: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/11.jpg)
Frontend Backend
Backend
Our case study
Stratego/XT
C/POSIX
![Page 12: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/12.jpg)
(spoofax.org)
Why Java?
![Page 13: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/13.jpg)
Backend
Architecture
Frontend
![Page 14: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/14.jpg)
Backend
Architecture
Standard libs
Programs
Frontend
![Page 15: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/15.jpg)
Primitives
Platform libsBackend
Architecture
Standard libs
Programs
Frontend
![Page 16: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/16.jpg)
Primitives
Platform libsBackend
Architecture
Standard libs
Programs
Frontend
Backend
Primitives
Platform libs
![Page 17: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/17.jpg)
Primitives
Platform libsBackend
Architecture
Standard libs
Programs
Frontend
Backend
Primitives
Platform libs
Portability aspects
![Page 18: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/18.jpg)
1. Glue code aspects
Override functions and library invocations
to work with platform-specific libraries
• SGLR vs. JSGLR
• ORM
• communication
• etc.
![Page 19: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/19.jpg)
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)
![Page 20: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/20.jpg)
2. Migration aspects
Warn developers about unportable code
Perform “next best” operation
![Page 21: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/21.jpg)
3. Integration aspects
Enhance platform integration:
•error handling (exceptions, console vs. GUI)
•logging
•hooks
•user interaction (console vs. GUI vs. web)
![Page 22: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/22.jpg)
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
![Page 23: Using Aspects for Language Portability (SCAM 2010)](https://reader031.vdocuments.site/reader031/viewer/2022030403/546cac13af7959294f8b45c5/html5/thumbnails/23.jpg)
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