SlideShare une entreprise Scribd logo
1  sur  61
Télécharger pour lire hors ligne
© Marcus Denker
Sub-method Structural and
Behavioral Reflection
Marcus Denker
Universität Bern
© Marcus Denker
The Systems of the future...
> ... are getting larger and more complex
> ... are getting more and more dependent on each other
> The demands are changing
2
© Marcus Denker
Examples of New Demands
> Dynamic Analysis
— Fine-grained selection
— Install / retract at runtime
— Complete system
> Development Environment
— Complete representation of the system
— Extensible
3
© Marcus Denker
Reflection
4
© Marcus Denker
Reflection
5
Program Description
© Marcus Denker
Reflection
6
Program Description
Query and Change
© Marcus Denker
Repeat: Demands
> Dynamic Analysis
— Fine-grained Selection
— Install / retract at runtime
— Complete System
> Development Environment
— Complete representation of the system
— Extensible
7
© Marcus Denker
Reflection to the Rescue
> Where?
> At runtime!
> Complete Structure
> Everywhere!
8
© Marcus Denker
Reflection to the Rescue
> Where?
> At runtime!
> Complete structure
> Everywhere!
9
Solved (Partial Behavioral Reflection, Eric Tanter)
© Marcus Denker
Three Problems of Reflection
1. Partial behavioral reflection needs to be
anticipated
2. Structural reflection is limited to the granularity of a
method
3. Behavioral reflection cannot be applied to the whole
system
10
© Marcus Denker
Three Problems of Reflection
1. Anticipation
2. Structural reflection is limited to the granularity of
a method
3. Behavioral reflection cannot be applied to the whole
system
11
© Marcus Denker
Three Problems of Reflection
1. Anticipation
2. Sub-method Structure
3. Behavioral reflection cannot be applied to the
whole system
12
© Marcus Denker
Three Problems of Reflection
1. Anticipation
2. Sub-method Structure
3. Context
13
© Marcus Denker
Thesis
To support unanticipated behavioral reflection,
reflection needs to be extended with sub-method
structure and with the concept of context.
14
© Marcus Denker
Contributions of the Dissertation
> Unanticipated partial behavioral reflection
> Sub-Method Structural Reflection
> Partial Behavioral Reflection using Annotations
> Contextual Reflection
15
© Marcus Denker
x
x x x
x
xx
x
Roadmap
16
1. Unanticipated partial behavioral reflection
2. Sub-Method Structure
3. Revisit Partial Reflection
4. Context
© Marcus Denker
Roadmap
17
1. Unanticipated partial behavioral reflection
2. Sub-Method Structure
3. Revisit Partial Reflection
4. Context
© Marcus Denker
Roadmap
18
1. Unanticipated partial behavioral reflection
2. Sub-Method Structure
3. Revisit Partial Reflection
4. Context
© Marcus Denker
base
meta
Roadmap
19
1. Unanticipated partial behavioral reflection
2. Sub-Method Structure
3. Revisit Partial Reflection
4. Context
© Marcus Denker
x
x x x
x
xx
x
Roadmap
20
1. Unanticipated partial behavioral reflection
2. Sub-Method Structure
3. Revisit Partial Reflection
4. Context
© Marcus Denker
x
x x x
x
xx
x
Reflex: Partial Behavioral Reflection
> Hooksets: collection of operation occurrences
> Links
— Bind hooksets to meta-objects
— Define protocol between base and meta
> Goals
— Highly selective reification
— Flexible meta-level engineering
– Protocol specification
– Cross-cutting hooksets
activation
condition
hookset
metaobject
links
Tanter, OOPSLA03
21
© Marcus Denker
x
x x x
x
xx
x
Example: Live Analysis
> Typical Web application (e.g. Wiki)
> Shows performance problem under high load
> Goals:
— Profile and fix the problem
— No restart / interruption of service
22
© Marcus Denker
x
x x x
x
xx
x
Live Analysis
— Install profiler
— Analyze
— Retract profiler
23
... while the system is running!
© Marcus Denker
x
x x x
x
xx
x
Live Profiling
> Operation:
— Method Execution (around)
> Hookset:
— All execution operations in the wiki package
> Metaobject:
— A profiling tool activation
condition
hookset
metaobject
links
24
© Marcus Denker
x
x x x
x
xx
x
Unanticipated Partial Behavioral
Reflection
> Geppetto: Unanticipated Partial Behavioral Reflection
— For Squeak 3.9 with Bytecode transformation
David Röthlisberger, Marcus Denker and Éric Tanter:
Unanticipated Partial Behavioral Reflection:
Adapting Applications at Runtime
Journal of Computer Languages, Systems and Structures, vol.
34, no. 2-3, July 2008, pp. 46-65.
25
© Marcus Denker
x
x x x
x
xx
x
Good Results
> Completely dynamic
> Simpler
> High performance
26
© Marcus Denker
Benchmarks Geppetto
> Slowdown for reification of message send
System Slowdown
Geppetto 10.85
Iguana/J 24
Metaclasstalk 20
© Marcus Denker
x
x x x
x
xx
x
Missing Sub-method Structure
> Semantic Mismatch
> Code Quality
> Synthesized Code
28
© Marcus Denker
Roadmap
1. Dynamic partial behavioral reflection
2. Sub-Method Structure
3. Revisit Partial Reflection
4. Context
29
© Marcus Denker
Methods and Reflection
> Method are Objects
— e.g in Smalltalk
> No high-level model for sub-method elements
— Message sends
— Assignments
— Variable access
> Structural reflection stops at the granularity of methods
30
© Marcus Denker
Sub-Method Reflection
> Many tools work on sub method level
— Profiler, Refactoring Tool, Debugger, Type Checker
> Communication between tools needed
— Example: Code coverage
> All tools use different representations
— Tools are harder to build
— Communication not possible
31
© Marcus Denker
Sub-method Representation
Requirements
> Causal Connection
> Abstraction Level
> Extensibility
> Persistent
> Size and Performance
32
© Marcus Denker
Existing Method Representations
> Existing representations for Methods
— Text
— Bytecode
— AST
33
© Marcus Denker
Text
> Low level abstraction
> Not causally connected
34
© Marcus Denker
Bytecode
> Low level abstraction
> Missing extensibility
> Mix of base- and meta-level code
35
1 16 0 0 160 197 59
17 172 94 7 17 204
122 70 17 92 94 7 17
65 112 224 135 120 88
141 0 252
© Marcus Denker
Abstract Syntax Tree
> Not causally connected
> Not extensible
> Not persistent
36
© Marcus Denker
Solution: Reflective Methods
> Annotated, persistent AST
> Bytecode generated on demand and cached
:ReflectiveMethod
annotation
#(12 13 45 38 98 128
84 72 42 77 22 28 59
32 7 49 51 87 64)
:CompiledMethod
compiledMethod
reflectiveMethodannotation
Tools VM
37
© Marcus Denker
Implementation: Persephone
> Implementation of Reflective Methods for Squeak
> Smalltalk compiler generates Reflective Methods
— Translated to bytecode on demand
> Open Compiler: Plugins
— Called before code generation
— Transform a copy of the AST
Marcus Denker, Stéphane Ducasse, Adrian Lienhard
Philippe Marschall: Sub-Method Reflection
Journal of Object Technology, vol. 6, no. 9,
38
© Marcus Denker
Requirements revisited
> Abstraction Level
> Causal Connection
> Extensibility
> Persistency
> Size and Performance
39
© Marcus Denker
Extensible with Annotations
> Source visible annotations
— extended Smalltalk syntax
> Source invisible annotations
— Reflective API
— Can reference any object
> Every node can be annotated
> Semantics: Compiler Plugins
(9 raisedTo: 10000) <:evaluateAtCompiletime:>
40
© Marcus Denker
Example: Pluggable Type-System
> Example for textual annotations
bitFromBoolean: aBoolean <:type: Boolean :>
^ (aBoolean ifTrue: [1] ifFalse: [0]) <:type: Integer :>
> Optional, pluggable type-system
> Types stored as annotations in the Reflective Methods
Niklaus Haldiman, Marcus Denker, Oscar Nierstrasz:
“Practical, Pluggable Types,” (ICDL 2007)
41
© Marcus Denker
Memory Requirements
number of classes memory
Squeak 3.9
Persephone
no reflective methods
Persephone
reflective methods
2040 15.7 MB
2224 20 MB
2224 123 MB
42
© Marcus Denker
Roadmap
1. Realize partial behavioral reflection in a dynamic
language
2. Sub-Method Structure
3. Revisit Partial Reflection
4. Context
43
© Marcus Denker
Partial Behavioral Reflection Revisited
> Problems of Bytecode:
— Semantic Mismatch
— Code Quality
— Synthesized Code
> With Sub-method Reflection, we can do better!
44
© Marcus Denker
Sub-method Structure
> Links can be annotations on the AST
45
+ =x
x x x
x
xx
x
© Marcus Denker
Performance Properties
> Very fast annotations
— No decompile!
> On-the-fly code generation
— Only code executed gets generated
> Generated code is fast
— Better then working on bytecode level
46
© Marcus Denker
x
x x x
x
xx
x
Repeat: Missing Sub-method Structure
> Semantic Mismatch
> Code Quality
> Synthesized Code
47
© Marcus Denker
Sub-method Structure
> Semantic Mismatch
> Code Quality
> Synthesized Code
48
© Marcus Denker
Example: Feature Annotations
> Features modeled
as traces
> Many Problems
— Space
— Merging Traces
> Solution: annotate
structure
Marcus Denker, Orla Greevy, Oscar Nierstrasz:
Supporting Feature Analysis with Runtime
Annotations (PCODA 2007)
49
source code
(AST)
instruction is
meta-object
links
© Marcus Denker
base
meta
Roadmap
1. Realize partial behavioral reflection in a dynamic
language
2. Sub-Method Structure
3. Revisit Partial Reflection
4. Context
50
© Marcus Denker
base
meta
Problem: Whole System
> Behavioral reflection cannot be applied to the whole
system
> Problem: recursion
— System classes
— Meta-objects
51
© Marcus Denker
base
meta
The Problem of Recursion
> Call the Beeper from OrderedCollection>>#add
52
beepLink := Link new metaObject: Beeper.
beepLink selector: #beep.
(OrderedCollection>>#add:) methodNode link: beepLink.
© Marcus Denker
base
meta
Meta-object Call Recursion
53
Base Level Meta Object Meta Object
Infinite recursion
#beep send
#add: send
#add: send
#beep send
#add: send
© Marcus Denker
base
meta
Representing Meta-level Execution
> Link enables
MetaContext
Base Level Meta Level
MetaContext activation
MetaContext deactivation
54
© Marcus Denker
base
meta
Context-aware Links
> Disable call when
already on the
meta-level
Base Level Meta Level
Stop meta-level call
55
© Marcus Denker
base
meta
MetaContext: Conclusion
> Recursion problem solved
56
operation
meta-object
links
level 0
base
meta
© Marcus Denker
base
meta
MetaContext: Conclusion
> Meta-level Analysis
Marcus Denker, Mathieu Suen,Stéphane Ducasse:
The Meta in Meta-object Architectures
TOOLS EUROPE 2008
operation
meta-object
links
level 0
metameta-
object
link
level 1
base
meta
meta-2
57
© Marcus Denker
Thesis Revisited
To support unanticipated behavioral reflection,
reflection needs to be extended with sub-method
structure and with the concept of context.
58
© Marcus Denker
Future Work
> Sub-method Structure
— Simpler AST
— AST compression
— Replace text with sub-method representation
> Behavioral Reflection
— Composition of Links
— Generalize context model: beyond the MetaContext
59
© Marcus Denker
Contributions of the Dissertation
> Unanticipated partial behavioral reflection
> Sub-Method Structural Reflection
> Partial Behavioral Reflection using Annotations
> Contextual Reflection
60
© Marcus Denker
Questions
> Unanticipated partial behavioral reflection
> Sub-Method Structural Reflection
> Partial Behavioral Reflection using Annotations
> Contextual Reflection
61
Questions?

Contenu connexe

En vedette

Pharo Status ESUG 2014
Pharo Status ESUG 2014Pharo Status ESUG 2014
Pharo Status ESUG 2014Marcus Denker
 
Get Involved, you can get an impact!
Get Involved, you can get an impact!Get Involved, you can get an impact!
Get Involved, you can get an impact!Marcus Denker
 
Nomads do not build Cathedrals
Nomads do not build CathedralsNomads do not build Cathedrals
Nomads do not build CathedralsMarcus Denker
 
VMs, Interpreters, JIT
VMs, Interpreters, JITVMs, Interpreters, JIT
VMs, Interpreters, JITMarcus Denker
 

En vedette (6)

The Pharo Roadmap
The Pharo RoadmapThe Pharo Roadmap
The Pharo Roadmap
 
Pharo Status ESUG 2014
Pharo Status ESUG 2014Pharo Status ESUG 2014
Pharo Status ESUG 2014
 
Get Involved, you can get an impact!
Get Involved, you can get an impact!Get Involved, you can get an impact!
Get Involved, you can get an impact!
 
Nomads do not build Cathedrals
Nomads do not build CathedralsNomads do not build Cathedrals
Nomads do not build Cathedrals
 
Research at RMOD
Research at RMODResearch at RMOD
Research at RMOD
 
VMs, Interpreters, JIT
VMs, Interpreters, JITVMs, Interpreters, JIT
VMs, Interpreters, JIT
 

Similaire à Sub-method Structural and Behavioral Reflection

Presentation about my Research
Presentation about my ResearchPresentation about my Research
Presentation about my ResearchMarcus Denker
 
The Reflectivity
The ReflectivityThe Reflectivity
The ReflectivityESUG
 
Reflection and Context
Reflection and ContextReflection and Context
Reflection and ContextMarcus Denker
 
Beyond Text - Methods as Objects
Beyond Text - Methods as ObjectsBeyond Text - Methods as Objects
Beyond Text - Methods as ObjectsMarcus Denker
 
Unanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral ReflectionUnanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral ReflectionESUG
 
Talk: Practical, Pluggable Types
Talk: Practical, Pluggable TypesTalk: Practical, Pluggable Types
Talk: Practical, Pluggable TypesMarcus Denker
 
Software Evolution from the Field: an Experience Report
Software Evolution from the Field: an Experience ReportSoftware Evolution from the Field: an Experience Report
Software Evolution from the Field: an Experience ReportMarcus Denker
 
Sub-Method Reflection
Sub-Method ReflectionSub-Method Reflection
Sub-Method ReflectionMarcus Denker
 
Unanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral ReflectionUnanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral ReflectionMarcus Denker
 
Design of Mechatronics System
Design of Mechatronics SystemDesign of Mechatronics System
Design of Mechatronics SystemVeerakumar S
 
Software design and Software engineering.pptx
Software design and Software engineering.pptxSoftware design and Software engineering.pptx
Software design and Software engineering.pptxDrTThendralCompSci
 
Practical, Pluggable Types
Practical, Pluggable TypesPractical, Pluggable Types
Practical, Pluggable TypesMarcus Denker
 
SE2_Lec 19_Design Principles and Design Patterns
SE2_Lec 19_Design Principles and Design PatternsSE2_Lec 19_Design Principles and Design Patterns
SE2_Lec 19_Design Principles and Design PatternsAmr E. Mohamed
 
SE2018_Lec 18_ Design Principles and Design Patterns
SE2018_Lec 18_ Design Principles and Design PatternsSE2018_Lec 18_ Design Principles and Design Patterns
SE2018_Lec 18_ Design Principles and Design PatternsAmr E. Mohamed
 

Similaire à Sub-method Structural and Behavioral Reflection (20)

Reflection
ReflectionReflection
Reflection
 
Reflectivity Demo
Reflectivity DemoReflectivity Demo
Reflectivity Demo
 
Presentation about my Research
Presentation about my ResearchPresentation about my Research
Presentation about my Research
 
The Reflectivity
The ReflectivityThe Reflectivity
The Reflectivity
 
Demo: Reflectivity
Demo: ReflectivityDemo: Reflectivity
Demo: Reflectivity
 
Reflection and Context
Reflection and ContextReflection and Context
Reflection and Context
 
Beyond Text - Methods as Objects
Beyond Text - Methods as ObjectsBeyond Text - Methods as Objects
Beyond Text - Methods as Objects
 
Unstuck
UnstuckUnstuck
Unstuck
 
Unanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral ReflectionUnanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral Reflection
 
Talk: Practical, Pluggable Types
Talk: Practical, Pluggable TypesTalk: Practical, Pluggable Types
Talk: Practical, Pluggable Types
 
Refactoring
RefactoringRefactoring
Refactoring
 
Software Evolution from the Field: an Experience Report
Software Evolution from the Field: an Experience ReportSoftware Evolution from the Field: an Experience Report
Software Evolution from the Field: an Experience Report
 
Sub-Method Reflection
Sub-Method ReflectionSub-Method Reflection
Sub-Method Reflection
 
Unanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral ReflectionUnanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral Reflection
 
08 refactoring
08 refactoring08 refactoring
08 refactoring
 
Design of Mechatronics System
Design of Mechatronics SystemDesign of Mechatronics System
Design of Mechatronics System
 
Software design and Software engineering.pptx
Software design and Software engineering.pptxSoftware design and Software engineering.pptx
Software design and Software engineering.pptx
 
Practical, Pluggable Types
Practical, Pluggable TypesPractical, Pluggable Types
Practical, Pluggable Types
 
SE2_Lec 19_Design Principles and Design Patterns
SE2_Lec 19_Design Principles and Design PatternsSE2_Lec 19_Design Principles and Design Patterns
SE2_Lec 19_Design Principles and Design Patterns
 
SE2018_Lec 18_ Design Principles and Design Patterns
SE2018_Lec 18_ Design Principles and Design PatternsSE2018_Lec 18_ Design Principles and Design Patterns
SE2018_Lec 18_ Design Principles and Design Patterns
 

Plus de Marcus Denker

ConstantBlocks in Pharo11
ConstantBlocks in Pharo11ConstantBlocks in Pharo11
ConstantBlocks in Pharo11Marcus Denker
 
First Class Variables as AST Annotations
First Class Variables as AST AnnotationsFirst Class Variables as AST Annotations
First Class Variables as AST AnnotationsMarcus Denker
 
Supporting Pharo / Getting Pharo Support
Supporting Pharo / Getting Pharo SupportSupporting Pharo / Getting Pharo Support
Supporting Pharo / Getting Pharo SupportMarcus Denker
 
Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"Marcus Denker
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerMarcus Denker
 
Lecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinksLecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinksMarcus Denker
 
Improving code completion for Pharo
Improving code completion for PharoImproving code completion for Pharo
Improving code completion for PharoMarcus Denker
 
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinksVUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinksMarcus Denker
 
Lecture: Advanced Reflection. MetaLinks
Lecture: Advanced Reflection. MetaLinksLecture: Advanced Reflection. MetaLinks
Lecture: Advanced Reflection. MetaLinksMarcus Denker
 
Open-Source: An Infinite Game
Open-Source: An Infinite GameOpen-Source: An Infinite Game
Open-Source: An Infinite GameMarcus Denker
 
PharoTechTalk: Contributing to Pharo
PharoTechTalk: Contributing to PharoPharoTechTalk: Contributing to Pharo
PharoTechTalk: Contributing to PharoMarcus Denker
 
Feedback Loops in Practice
Feedback Loops in PracticeFeedback Loops in Practice
Feedback Loops in PracticeMarcus Denker
 

Plus de Marcus Denker (20)

Soil And Pharo
Soil And PharoSoil And Pharo
Soil And Pharo
 
ConstantBlocks in Pharo11
ConstantBlocks in Pharo11ConstantBlocks in Pharo11
ConstantBlocks in Pharo11
 
Demo: Improved DoIt
Demo: Improved DoItDemo: Improved DoIt
Demo: Improved DoIt
 
First Class Variables as AST Annotations
First Class Variables as AST AnnotationsFirst Class Variables as AST Annotations
First Class Variables as AST Annotations
 
Supporting Pharo / Getting Pharo Support
Supporting Pharo / Getting Pharo SupportSupporting Pharo / Getting Pharo Support
Supporting Pharo / Getting Pharo Support
 
Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Variables in Pharo
Variables in PharoVariables in Pharo
Variables in Pharo
 
Lecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinksLecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinks
 
Improving code completion for Pharo
Improving code completion for PharoImproving code completion for Pharo
Improving code completion for Pharo
 
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinksVUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
 
Slot Composition
Slot CompositionSlot Composition
Slot Composition
 
Lecture: Advanced Reflection. MetaLinks
Lecture: Advanced Reflection. MetaLinksLecture: Advanced Reflection. MetaLinks
Lecture: Advanced Reflection. MetaLinks
 
PHARO IOT
PHARO IOTPHARO IOT
PHARO IOT
 
Open-Source: An Infinite Game
Open-Source: An Infinite GameOpen-Source: An Infinite Game
Open-Source: An Infinite Game
 
Lecture: MetaLinks
Lecture: MetaLinksLecture: MetaLinks
Lecture: MetaLinks
 
PharoTechTalk: Contributing to Pharo
PharoTechTalk: Contributing to PharoPharoTechTalk: Contributing to Pharo
PharoTechTalk: Contributing to Pharo
 
Feedback Loops in Practice
Feedback Loops in PracticeFeedback Loops in Practice
Feedback Loops in Practice
 
Pharo6 - ESUG17
Pharo6 - ESUG17Pharo6 - ESUG17
Pharo6 - ESUG17
 
Pharo6
Pharo6Pharo6
Pharo6
 

Dernier

Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"DianaGray10
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Alexander Turgeon
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...Daniel Zivkovic
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
The Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementThe Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementNuwan Dias
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?Juan Carlos Gonzalez
 
UiPath Studio Web workshop series - Day 5
UiPath Studio Web workshop series - Day 5UiPath Studio Web workshop series - Day 5
UiPath Studio Web workshop series - Day 5DianaGray10
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 

Dernier (20)

Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
The Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementThe Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API Management
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?
 
UiPath Studio Web workshop series - Day 5
UiPath Studio Web workshop series - Day 5UiPath Studio Web workshop series - Day 5
UiPath Studio Web workshop series - Day 5
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 

Sub-method Structural and Behavioral Reflection

  • 1. © Marcus Denker Sub-method Structural and Behavioral Reflection Marcus Denker Universität Bern
  • 2. © Marcus Denker The Systems of the future... > ... are getting larger and more complex > ... are getting more and more dependent on each other > The demands are changing 2
  • 3. © Marcus Denker Examples of New Demands > Dynamic Analysis — Fine-grained selection — Install / retract at runtime — Complete system > Development Environment — Complete representation of the system — Extensible 3
  • 6. © Marcus Denker Reflection 6 Program Description Query and Change
  • 7. © Marcus Denker Repeat: Demands > Dynamic Analysis — Fine-grained Selection — Install / retract at runtime — Complete System > Development Environment — Complete representation of the system — Extensible 7
  • 8. © Marcus Denker Reflection to the Rescue > Where? > At runtime! > Complete Structure > Everywhere! 8
  • 9. © Marcus Denker Reflection to the Rescue > Where? > At runtime! > Complete structure > Everywhere! 9 Solved (Partial Behavioral Reflection, Eric Tanter)
  • 10. © Marcus Denker Three Problems of Reflection 1. Partial behavioral reflection needs to be anticipated 2. Structural reflection is limited to the granularity of a method 3. Behavioral reflection cannot be applied to the whole system 10
  • 11. © Marcus Denker Three Problems of Reflection 1. Anticipation 2. Structural reflection is limited to the granularity of a method 3. Behavioral reflection cannot be applied to the whole system 11
  • 12. © Marcus Denker Three Problems of Reflection 1. Anticipation 2. Sub-method Structure 3. Behavioral reflection cannot be applied to the whole system 12
  • 13. © Marcus Denker Three Problems of Reflection 1. Anticipation 2. Sub-method Structure 3. Context 13
  • 14. © Marcus Denker Thesis To support unanticipated behavioral reflection, reflection needs to be extended with sub-method structure and with the concept of context. 14
  • 15. © Marcus Denker Contributions of the Dissertation > Unanticipated partial behavioral reflection > Sub-Method Structural Reflection > Partial Behavioral Reflection using Annotations > Contextual Reflection 15
  • 16. © Marcus Denker x x x x x xx x Roadmap 16 1. Unanticipated partial behavioral reflection 2. Sub-Method Structure 3. Revisit Partial Reflection 4. Context
  • 17. © Marcus Denker Roadmap 17 1. Unanticipated partial behavioral reflection 2. Sub-Method Structure 3. Revisit Partial Reflection 4. Context
  • 18. © Marcus Denker Roadmap 18 1. Unanticipated partial behavioral reflection 2. Sub-Method Structure 3. Revisit Partial Reflection 4. Context
  • 19. © Marcus Denker base meta Roadmap 19 1. Unanticipated partial behavioral reflection 2. Sub-Method Structure 3. Revisit Partial Reflection 4. Context
  • 20. © Marcus Denker x x x x x xx x Roadmap 20 1. Unanticipated partial behavioral reflection 2. Sub-Method Structure 3. Revisit Partial Reflection 4. Context
  • 21. © Marcus Denker x x x x x xx x Reflex: Partial Behavioral Reflection > Hooksets: collection of operation occurrences > Links — Bind hooksets to meta-objects — Define protocol between base and meta > Goals — Highly selective reification — Flexible meta-level engineering – Protocol specification – Cross-cutting hooksets activation condition hookset metaobject links Tanter, OOPSLA03 21
  • 22. © Marcus Denker x x x x x xx x Example: Live Analysis > Typical Web application (e.g. Wiki) > Shows performance problem under high load > Goals: — Profile and fix the problem — No restart / interruption of service 22
  • 23. © Marcus Denker x x x x x xx x Live Analysis — Install profiler — Analyze — Retract profiler 23 ... while the system is running!
  • 24. © Marcus Denker x x x x x xx x Live Profiling > Operation: — Method Execution (around) > Hookset: — All execution operations in the wiki package > Metaobject: — A profiling tool activation condition hookset metaobject links 24
  • 25. © Marcus Denker x x x x x xx x Unanticipated Partial Behavioral Reflection > Geppetto: Unanticipated Partial Behavioral Reflection — For Squeak 3.9 with Bytecode transformation David Röthlisberger, Marcus Denker and Éric Tanter: Unanticipated Partial Behavioral Reflection: Adapting Applications at Runtime Journal of Computer Languages, Systems and Structures, vol. 34, no. 2-3, July 2008, pp. 46-65. 25
  • 26. © Marcus Denker x x x x x xx x Good Results > Completely dynamic > Simpler > High performance 26
  • 27. © Marcus Denker Benchmarks Geppetto > Slowdown for reification of message send System Slowdown Geppetto 10.85 Iguana/J 24 Metaclasstalk 20
  • 28. © Marcus Denker x x x x x xx x Missing Sub-method Structure > Semantic Mismatch > Code Quality > Synthesized Code 28
  • 29. © Marcus Denker Roadmap 1. Dynamic partial behavioral reflection 2. Sub-Method Structure 3. Revisit Partial Reflection 4. Context 29
  • 30. © Marcus Denker Methods and Reflection > Method are Objects — e.g in Smalltalk > No high-level model for sub-method elements — Message sends — Assignments — Variable access > Structural reflection stops at the granularity of methods 30
  • 31. © Marcus Denker Sub-Method Reflection > Many tools work on sub method level — Profiler, Refactoring Tool, Debugger, Type Checker > Communication between tools needed — Example: Code coverage > All tools use different representations — Tools are harder to build — Communication not possible 31
  • 32. © Marcus Denker Sub-method Representation Requirements > Causal Connection > Abstraction Level > Extensibility > Persistent > Size and Performance 32
  • 33. © Marcus Denker Existing Method Representations > Existing representations for Methods — Text — Bytecode — AST 33
  • 34. © Marcus Denker Text > Low level abstraction > Not causally connected 34
  • 35. © Marcus Denker Bytecode > Low level abstraction > Missing extensibility > Mix of base- and meta-level code 35 1 16 0 0 160 197 59 17 172 94 7 17 204 122 70 17 92 94 7 17 65 112 224 135 120 88 141 0 252
  • 36. © Marcus Denker Abstract Syntax Tree > Not causally connected > Not extensible > Not persistent 36
  • 37. © Marcus Denker Solution: Reflective Methods > Annotated, persistent AST > Bytecode generated on demand and cached :ReflectiveMethod annotation #(12 13 45 38 98 128 84 72 42 77 22 28 59 32 7 49 51 87 64) :CompiledMethod compiledMethod reflectiveMethodannotation Tools VM 37
  • 38. © Marcus Denker Implementation: Persephone > Implementation of Reflective Methods for Squeak > Smalltalk compiler generates Reflective Methods — Translated to bytecode on demand > Open Compiler: Plugins — Called before code generation — Transform a copy of the AST Marcus Denker, Stéphane Ducasse, Adrian Lienhard Philippe Marschall: Sub-Method Reflection Journal of Object Technology, vol. 6, no. 9, 38
  • 39. © Marcus Denker Requirements revisited > Abstraction Level > Causal Connection > Extensibility > Persistency > Size and Performance 39
  • 40. © Marcus Denker Extensible with Annotations > Source visible annotations — extended Smalltalk syntax > Source invisible annotations — Reflective API — Can reference any object > Every node can be annotated > Semantics: Compiler Plugins (9 raisedTo: 10000) <:evaluateAtCompiletime:> 40
  • 41. © Marcus Denker Example: Pluggable Type-System > Example for textual annotations bitFromBoolean: aBoolean <:type: Boolean :> ^ (aBoolean ifTrue: [1] ifFalse: [0]) <:type: Integer :> > Optional, pluggable type-system > Types stored as annotations in the Reflective Methods Niklaus Haldiman, Marcus Denker, Oscar Nierstrasz: “Practical, Pluggable Types,” (ICDL 2007) 41
  • 42. © Marcus Denker Memory Requirements number of classes memory Squeak 3.9 Persephone no reflective methods Persephone reflective methods 2040 15.7 MB 2224 20 MB 2224 123 MB 42
  • 43. © Marcus Denker Roadmap 1. Realize partial behavioral reflection in a dynamic language 2. Sub-Method Structure 3. Revisit Partial Reflection 4. Context 43
  • 44. © Marcus Denker Partial Behavioral Reflection Revisited > Problems of Bytecode: — Semantic Mismatch — Code Quality — Synthesized Code > With Sub-method Reflection, we can do better! 44
  • 45. © Marcus Denker Sub-method Structure > Links can be annotations on the AST 45 + =x x x x x xx x
  • 46. © Marcus Denker Performance Properties > Very fast annotations — No decompile! > On-the-fly code generation — Only code executed gets generated > Generated code is fast — Better then working on bytecode level 46
  • 47. © Marcus Denker x x x x x xx x Repeat: Missing Sub-method Structure > Semantic Mismatch > Code Quality > Synthesized Code 47
  • 48. © Marcus Denker Sub-method Structure > Semantic Mismatch > Code Quality > Synthesized Code 48
  • 49. © Marcus Denker Example: Feature Annotations > Features modeled as traces > Many Problems — Space — Merging Traces > Solution: annotate structure Marcus Denker, Orla Greevy, Oscar Nierstrasz: Supporting Feature Analysis with Runtime Annotations (PCODA 2007) 49 source code (AST) instruction is meta-object links
  • 50. © Marcus Denker base meta Roadmap 1. Realize partial behavioral reflection in a dynamic language 2. Sub-Method Structure 3. Revisit Partial Reflection 4. Context 50
  • 51. © Marcus Denker base meta Problem: Whole System > Behavioral reflection cannot be applied to the whole system > Problem: recursion — System classes — Meta-objects 51
  • 52. © Marcus Denker base meta The Problem of Recursion > Call the Beeper from OrderedCollection>>#add 52 beepLink := Link new metaObject: Beeper. beepLink selector: #beep. (OrderedCollection>>#add:) methodNode link: beepLink.
  • 53. © Marcus Denker base meta Meta-object Call Recursion 53 Base Level Meta Object Meta Object Infinite recursion #beep send #add: send #add: send #beep send #add: send
  • 54. © Marcus Denker base meta Representing Meta-level Execution > Link enables MetaContext Base Level Meta Level MetaContext activation MetaContext deactivation 54
  • 55. © Marcus Denker base meta Context-aware Links > Disable call when already on the meta-level Base Level Meta Level Stop meta-level call 55
  • 56. © Marcus Denker base meta MetaContext: Conclusion > Recursion problem solved 56 operation meta-object links level 0 base meta
  • 57. © Marcus Denker base meta MetaContext: Conclusion > Meta-level Analysis Marcus Denker, Mathieu Suen,Stéphane Ducasse: The Meta in Meta-object Architectures TOOLS EUROPE 2008 operation meta-object links level 0 metameta- object link level 1 base meta meta-2 57
  • 58. © Marcus Denker Thesis Revisited To support unanticipated behavioral reflection, reflection needs to be extended with sub-method structure and with the concept of context. 58
  • 59. © Marcus Denker Future Work > Sub-method Structure — Simpler AST — AST compression — Replace text with sub-method representation > Behavioral Reflection — Composition of Links — Generalize context model: beyond the MetaContext 59
  • 60. © Marcus Denker Contributions of the Dissertation > Unanticipated partial behavioral reflection > Sub-Method Structural Reflection > Partial Behavioral Reflection using Annotations > Contextual Reflection 60
  • 61. © Marcus Denker Questions > Unanticipated partial behavioral reflection > Sub-Method Structural Reflection > Partial Behavioral Reflection using Annotations > Contextual Reflection 61 Questions?