SlideShare uma empresa Scribd logo
1 de 25
Baixar para ler offline
Beyond Text - Methods As Objects




  Marcus Denker
  Software Composition Group
  University of Berne - Switzerland




  © Marcus Denker
Software Composition Group
University of Berne

> Lead by Oscar Nierstrasz and Stephane Ducasse
> Overall Focus: Software Evolution
> Two parts:
     — Evolution of Existing Systems (Reengineering)
           –      Moose, CodeCrawler
     — Language Design for enabling Evolution
           –      Traits
           –      ClassBoxes


>    Forward and Reverse engineering viewpoints
     — We start to see many parallels / cross fertilization


© Marcus Denker
Roadmap


>    Reflective Systems
     — Behavioral Reflection
     — Squeak’s Reflective capabilties
>    Methods in Squeak
     — Methods as Objects
     — Objects as Methods
>    ByteSurgeon and Geppetto
     — Usage
     — Problems
>    Beyond text


© Marcus Denker
Reflection



>    Object oriented model of the system available inside the
     system
     — called “Introspection”
     — Java
>    Model is causally connected
     — Changing this model changes the system
     — called “Intercession”


>    Reflection = Introspection + Intercession


© Marcus Denker
Behavioral and Structural


>    Structural reflection: changing structure
     — Add / remove classes and methods
     — Add / remove instance variables
     — Change inheritance relationship


>    Behavioral reflection: changing behavior
     — What is inheritance?
     — Hook into instance variable stores (e.g. persistence)

>    Both are related
     — change of structure changes behavior


© Marcus Denker
Usage: Why Reflection


>    Structural reflection
     — Changing systems at runtime
     — Powerful development environments (no edit-compile-run)
     — Analysis (through introspection)

>    Behavioral reflection
     —    Language experiments
     —    Debugging
     —    Dynamic analysis (tracing, visualization)
     —    New language features (e.g. persistence)



© Marcus Denker
Squeak: A Reflective System




>    Squeak: open source Smalltalk
     — Classes and methods are objects
     — Changing these objects changes the system (at runtime)
>    API for
     — adding / removing classes + methods
     — adding / removing instance variables
     — changing inheritance relationship




© Marcus Denker
Squeak: Behavioral Reflection



>    Behavioral Reflection: only by changing methods

>    There is no API for introspection/intercession of
     —    Instance variable access
     —    Temp variable access
     —    Message sending
     —    Message lookup
     —    Method execution




© Marcus Denker
Structural Reflection enables
Behavioral Reflection



> General: Change of structure changes behavior
> We can use the structural reflection API to provide
  behavioral reflection
     — Methods are objects
     — We can just replace them with our version that does what we
       want




© Marcus Denker
Behavioral Reflection: Howto?



>    Method Wrappers (e.g. used by AspectS)
     — Gives access to before / after of method execution
>    Squeak’s Objects-As-Methods
     — we can install any object as a method that implements a simple
       protocol (#run:with:in)
     — used by ClassBoxes, FacetS
     — reifies method execution

>    Transformation of text / AST / Bytecode


© Marcus Denker
ByteSurgeon




>    Framework for editing bytecode for Squeak
     — Like Javasist in Java, but:

>    Uses structural reflection to transform at runtime
     — Simple model: Inline code before / after a bytecode
     — Inlined code is normal smalltalk code
     — Not much knowledge about bytecode needed




© Marcus Denker
Example for Bytesurgeon I


>    Goal: Logging Message send

    example
         self test.




                      example
                          Transcript show: ‘sending #test’.
                          self test.




© Marcus Denker
Example for Bytesurgeon II

> Goal: Log message send
> with ByteSurgeon:


     (Example>>#example) instrumentSend: [:send |
          send insertBefore:
                  ‘Transcript show: ‘’sending #test’’ ‘.
     ]	





© Marcus Denker
Uses of ByteSurgeon at SCG



>    Implementation of fast MethodWrapper
     — 35 lines of code

>    Trace library for runtime tracing

>    Back-In-Time Debugger

>    Runtime analysis: test coverage



© Marcus Denker
Problems of ByteSurgeon



>    Performance
     — Faster then code / AST
     — But installation takes some time

>    Abstractions too low level
     — Bytecode
     — We want to abstract away from bytecode and talk about
       instance variable access, message sending...
     — Not a good meta model



© Marcus Denker
Geppetto


> Framework for behavioral reflection
> Build on top of ByteSurgeon
     — but abstracts from bytecode


>    Fine grained scoping of reflection
     — spatial (where? and what?)
     — temporal (when?)


>    Based on the Reflex Model (Eric Tanter)


© Marcus Denker
Geppetto: Big Picture




                  AOP          Tracer   .......


                    Geppetto

                    ByteSurgeon

                    Squeak


© Marcus Denker
Geppetto: Modell




                   Reflex
                   (Tanter OOPSLA 03)


© Marcus Denker
Problem with Bytecode in Geppetto



> Bytecode is not a good meta model
> Lots of management infrastructure is needed
     — Hook composition
     — Synthesised elements (hooks) vs. original code
     — Mapping to source elements

>    Bytecode is optimized
     — e.g. no ifTrue:




© Marcus Denker
Beyond Text: A Meta Model for
Methods




> We need a high-level meta model for methods
> This model needs to be causally connected
     — edit the model --> edit the system


>    Text and Byte- (Binary-) code generated on demand




© Marcus Denker
Beyond Text: A Meta Model for
Methods

>    Structure of method is implicit
     — Compile text (to AST)
     — Decompile bytecode (to IR or AST)

> Both text and bytecode are pretty low level
> Not suited for being the main representation
     — How to annotate text?
     — How to tag synthesised bytecode?


>    Possible Model: AST


© Marcus Denker
Many users


                                       Aspects
             Refactoring                            JIT



                                 Method
  Editor                        Meta Model
  (pretty printer)                                  Pluggable
                                                    Typesystem

                  Annotations           Reflection
© Marcus Denker
Explorations...



>    Annotation framework
     — Nodes can be annotated
     — We can have any object as a (non-textual) annotation



> replace ByteSurgeon by AST based transformer
> Idea: Behavioral Reflection with Annotations
> Combine with AspectS for dynamic Aspects




© Marcus Denker
Conclusion




>    We have had a quick intro in Reflection
     — Squeak and how it enables reflection
>    How to realize behavioral reflection
     — Bytesurgeon and Geppetto
     — Problems

>    We need a Meta Model for Methods




© Marcus Denker
License

>    http://creativecommons.org/licenses/by-sa/2.5/



                                           Attribution-ShareAlike 2.5
     You are free:
     • to copy, distribute, display, and perform the work
     • to make derivative works
     • to make commercial use of the work

     Under the following conditions:

              Attribution. You must attribute the work in the manner specified by the author or licensor.

     
              Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting
              work only under a license identical to this one.

     • For any reuse or distribution, you must make clear to others the license terms of this work.
     • Any of these conditions can be waived if you get permission from the copyright holder.

                     Your fair use and other rights are in no way affected by the above.
© Marcus Denker

Mais conteúdo relacionado

Mais procurados

Linux scheduling and input and output
Linux scheduling and input and outputLinux scheduling and input and output
Linux scheduling and input and outputSanidhya Chugh
 
Kqueue : Generic Event notification
Kqueue : Generic Event notificationKqueue : Generic Event notification
Kqueue : Generic Event notificationMahendra M
 
A Deep Dive into Apache Cassandra for .NET Developers
A Deep Dive into Apache Cassandra for .NET DevelopersA Deep Dive into Apache Cassandra for .NET Developers
A Deep Dive into Apache Cassandra for .NET DevelopersLuke Tillman
 
JActor Cluster Platform
JActor Cluster PlatformJActor Cluster Platform
JActor Cluster PlatformBill La Forge
 
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...
GopherCon 2017 -  Writing Networking Clients in Go: The Design & Implementati...GopherCon 2017 -  Writing Networking Clients in Go: The Design & Implementati...
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...wallyqs
 
Flink Architecture
Flink Architecture Flink Architecture
Flink Architecture Prasad Wali
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik TambekarPratik Tambekar
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik TambekarPratik Tambekar
 
Cassandra Architecture
Cassandra ArchitectureCassandra Architecture
Cassandra ArchitecturePrasad Wali
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeperSaurav Haloi
 
Linux process management
Linux process managementLinux process management
Linux process managementRaghu nath
 
ProstgreSQLFailoverConfiguration
ProstgreSQLFailoverConfigurationProstgreSQLFailoverConfiguration
ProstgreSQLFailoverConfigurationSuyog Shirgaonkar
 
Lcj pg sql-lt-kaigai
Lcj pg sql-lt-kaigaiLcj pg sql-lt-kaigai
Lcj pg sql-lt-kaigaiKohei KaiGai
 
Scheduler activations
Scheduler activationsScheduler activations
Scheduler activationsVin Voro
 
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...Kasun Gajasinghe
 
Client-centric Consistency Models
Client-centric Consistency ModelsClient-centric Consistency Models
Client-centric Consistency ModelsEnsar Basri Kahveci
 

Mais procurados (20)

Linux scheduling and input and output
Linux scheduling and input and outputLinux scheduling and input and output
Linux scheduling and input and output
 
Chapter 6 os
Chapter 6 osChapter 6 os
Chapter 6 os
 
Kqueue : Generic Event notification
Kqueue : Generic Event notificationKqueue : Generic Event notification
Kqueue : Generic Event notification
 
A Deep Dive into Apache Cassandra for .NET Developers
A Deep Dive into Apache Cassandra for .NET DevelopersA Deep Dive into Apache Cassandra for .NET Developers
A Deep Dive into Apache Cassandra for .NET Developers
 
JActor Cluster Platform
JActor Cluster PlatformJActor Cluster Platform
JActor Cluster Platform
 
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...
GopherCon 2017 -  Writing Networking Clients in Go: The Design & Implementati...GopherCon 2017 -  Writing Networking Clients in Go: The Design & Implementati...
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...
 
Process scheduling linux
Process scheduling linuxProcess scheduling linux
Process scheduling linux
 
Flink Architecture
Flink Architecture Flink Architecture
Flink Architecture
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik Tambekar
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik Tambekar
 
Cassandra Architecture
Cassandra ArchitectureCassandra Architecture
Cassandra Architecture
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeper
 
Linux process management
Linux process managementLinux process management
Linux process management
 
Multithreading
MultithreadingMultithreading
Multithreading
 
ProstgreSQLFailoverConfiguration
ProstgreSQLFailoverConfigurationProstgreSQLFailoverConfiguration
ProstgreSQLFailoverConfiguration
 
Lcj pg sql-lt-kaigai
Lcj pg sql-lt-kaigaiLcj pg sql-lt-kaigai
Lcj pg sql-lt-kaigai
 
Scheduler activations
Scheduler activationsScheduler activations
Scheduler activations
 
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
 
Chapter 3 chapter reading task
Chapter 3 chapter reading taskChapter 3 chapter reading task
Chapter 3 chapter reading task
 
Client-centric Consistency Models
Client-centric Consistency ModelsClient-centric Consistency Models
Client-centric Consistency Models
 

Destaque

Practical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time DebuggingPractical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time Debugginglienhard
 
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
 
Fosdem 13: Pharo 2.0 update
Fosdem 13: Pharo 2.0 updateFosdem 13: Pharo 2.0 update
Fosdem 13: Pharo 2.0 updateMarcus Denker
 
Reflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond SmalltakReflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond SmalltakMarcus Denker
 

Destaque (6)

Practical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time DebuggingPractical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time Debugging
 
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
 
Reflection
ReflectionReflection
Reflection
 
Pharo ESUG
Pharo ESUGPharo ESUG
Pharo ESUG
 
Fosdem 13: Pharo 2.0 update
Fosdem 13: Pharo 2.0 updateFosdem 13: Pharo 2.0 update
Fosdem 13: Pharo 2.0 update
 
Reflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond SmalltakReflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond Smalltak
 

Semelhante a Beyond Text Methods as Objects

Reflection and Context
Reflection and ContextReflection and Context
Reflection and ContextMarcus Denker
 
Unanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral ReflectionUnanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral ReflectionESUG
 
Sub-Method Reflection
Sub-Method ReflectionSub-Method Reflection
Sub-Method ReflectionMarcus Denker
 
Presentation about my Research
Presentation about my ResearchPresentation about my Research
Presentation about my ResearchMarcus Denker
 
Sub-method Structural and Behavioral Reflection
Sub-method Structural and Behavioral ReflectionSub-method Structural and Behavioral Reflection
Sub-method Structural and Behavioral ReflectionMarcus Denker
 
Talk: Practical, Pluggable Types
Talk: Practical, Pluggable TypesTalk: Practical, Pluggable Types
Talk: Practical, Pluggable TypesMarcus Denker
 
The Reflectivity
The ReflectivityThe Reflectivity
The ReflectivityESUG
 
Behavioral Reflection
Behavioral ReflectionBehavioral Reflection
Behavioral ReflectionMarcus Denker
 
Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"Marcus Denker
 
Lecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinksLecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinksMarcus 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
 
Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"LogeekNightUkraine
 
DDD, CQRS and testing with ASP.Net MVC
DDD, CQRS and testing with ASP.Net MVCDDD, CQRS and testing with ASP.Net MVC
DDD, CQRS and testing with ASP.Net MVCAndy Butland
 
Unit 5 design engineering ssad
Unit 5 design engineering ssadUnit 5 design engineering ssad
Unit 5 design engineering ssadPreeti Mishra
 
Lecture: Refactoring
Lecture: RefactoringLecture: Refactoring
Lecture: RefactoringMarcus Denker
 

Semelhante a Beyond Text Methods as Objects (20)

Lecture: Reflection
Lecture: ReflectionLecture: Reflection
Lecture: Reflection
 
Reflection and Context
Reflection and ContextReflection and Context
Reflection and Context
 
Refactoring
RefactoringRefactoring
Refactoring
 
Unanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral ReflectionUnanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral Reflection
 
Sub-Method Reflection
Sub-Method ReflectionSub-Method Reflection
Sub-Method Reflection
 
Presentation about my Research
Presentation about my ResearchPresentation about my Research
Presentation about my Research
 
Sub-method Structural and Behavioral Reflection
Sub-method Structural and Behavioral ReflectionSub-method Structural and Behavioral Reflection
Sub-method Structural and Behavioral Reflection
 
Talk: Practical, Pluggable Types
Talk: Practical, Pluggable TypesTalk: Practical, Pluggable Types
Talk: Practical, Pluggable Types
 
The Reflectivity
The ReflectivityThe Reflectivity
The Reflectivity
 
Behavioral Reflection
Behavioral ReflectionBehavioral Reflection
Behavioral Reflection
 
Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"
 
Lecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinksLecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinks
 
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
 
Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"
 
08 refactoring
08 refactoring08 refactoring
08 refactoring
 
DDD, CQRS and testing with ASP.Net MVC
DDD, CQRS and testing with ASP.Net MVCDDD, CQRS and testing with ASP.Net MVC
DDD, CQRS and testing with ASP.Net MVC
 
Stoop 305-reflective programming5
Stoop 305-reflective programming5Stoop 305-reflective programming5
Stoop 305-reflective programming5
 
Unit 5 design engineering ssad
Unit 5 design engineering ssadUnit 5 design engineering ssad
Unit 5 design engineering ssad
 
Lecture: Refactoring
Lecture: RefactoringLecture: Refactoring
Lecture: Refactoring
 
Typesafe spark- Zalando meetup
Typesafe spark- Zalando meetupTypesafe spark- Zalando meetup
Typesafe spark- Zalando meetup
 

Mais 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
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerMarcus Denker
 
Improving code completion for Pharo
Improving code completion for PharoImproving code completion for Pharo
Improving code completion for PharoMarcus 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
 
Reflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond SmalltakReflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond SmalltakMarcus Denker
 
Perfection & Feedback Loops or: why worse is better
Perfection & Feedback Loops or: why worse is betterPerfection & Feedback Loops or: why worse is better
Perfection & Feedback Loops or: why worse is betterMarcus Denker
 
Dynamically Composing Collection Operations through Collection Promises
Dynamically Composing Collection Operations through Collection PromisesDynamically Composing Collection Operations through Collection Promises
Dynamically Composing Collection Operations through Collection PromisesMarcus Denker
 

Mais 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
 
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
 
Improving code completion for Pharo
Improving code completion for PharoImproving code completion for Pharo
Improving code completion for Pharo
 
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
 
Reflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond SmalltakReflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond Smalltak
 
Perfection & Feedback Loops or: why worse is better
Perfection & Feedback Loops or: why worse is betterPerfection & Feedback Loops or: why worse is better
Perfection & Feedback Loops or: why worse is better
 
Dynamically Composing Collection Operations through Collection Promises
Dynamically Composing Collection Operations through Collection PromisesDynamically Composing Collection Operations through Collection Promises
Dynamically Composing Collection Operations through Collection Promises
 

Último

Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 

Último (20)

Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 

Beyond Text Methods as Objects

  • 1. Beyond Text - Methods As Objects Marcus Denker Software Composition Group University of Berne - Switzerland © Marcus Denker
  • 2. Software Composition Group University of Berne > Lead by Oscar Nierstrasz and Stephane Ducasse > Overall Focus: Software Evolution > Two parts: — Evolution of Existing Systems (Reengineering) – Moose, CodeCrawler — Language Design for enabling Evolution – Traits – ClassBoxes > Forward and Reverse engineering viewpoints — We start to see many parallels / cross fertilization © Marcus Denker
  • 3. Roadmap > Reflective Systems — Behavioral Reflection — Squeak’s Reflective capabilties > Methods in Squeak — Methods as Objects — Objects as Methods > ByteSurgeon and Geppetto — Usage — Problems > Beyond text © Marcus Denker
  • 4. Reflection > Object oriented model of the system available inside the system — called “Introspection” — Java > Model is causally connected — Changing this model changes the system — called “Intercession” > Reflection = Introspection + Intercession © Marcus Denker
  • 5. Behavioral and Structural > Structural reflection: changing structure — Add / remove classes and methods — Add / remove instance variables — Change inheritance relationship > Behavioral reflection: changing behavior — What is inheritance? — Hook into instance variable stores (e.g. persistence) > Both are related — change of structure changes behavior © Marcus Denker
  • 6. Usage: Why Reflection > Structural reflection — Changing systems at runtime — Powerful development environments (no edit-compile-run) — Analysis (through introspection) > Behavioral reflection — Language experiments — Debugging — Dynamic analysis (tracing, visualization) — New language features (e.g. persistence) © Marcus Denker
  • 7. Squeak: A Reflective System > Squeak: open source Smalltalk — Classes and methods are objects — Changing these objects changes the system (at runtime) > API for — adding / removing classes + methods — adding / removing instance variables — changing inheritance relationship © Marcus Denker
  • 8. Squeak: Behavioral Reflection > Behavioral Reflection: only by changing methods > There is no API for introspection/intercession of — Instance variable access — Temp variable access — Message sending — Message lookup — Method execution © Marcus Denker
  • 9. Structural Reflection enables Behavioral Reflection > General: Change of structure changes behavior > We can use the structural reflection API to provide behavioral reflection — Methods are objects — We can just replace them with our version that does what we want © Marcus Denker
  • 10. Behavioral Reflection: Howto? > Method Wrappers (e.g. used by AspectS) — Gives access to before / after of method execution > Squeak’s Objects-As-Methods — we can install any object as a method that implements a simple protocol (#run:with:in) — used by ClassBoxes, FacetS — reifies method execution > Transformation of text / AST / Bytecode © Marcus Denker
  • 11. ByteSurgeon > Framework for editing bytecode for Squeak — Like Javasist in Java, but: > Uses structural reflection to transform at runtime — Simple model: Inline code before / after a bytecode — Inlined code is normal smalltalk code — Not much knowledge about bytecode needed © Marcus Denker
  • 12. Example for Bytesurgeon I > Goal: Logging Message send example self test. example Transcript show: ‘sending #test’. self test. © Marcus Denker
  • 13. Example for Bytesurgeon II > Goal: Log message send > with ByteSurgeon: (Example>>#example) instrumentSend: [:send | send insertBefore: ‘Transcript show: ‘’sending #test’’ ‘. ] © Marcus Denker
  • 14. Uses of ByteSurgeon at SCG > Implementation of fast MethodWrapper — 35 lines of code > Trace library for runtime tracing > Back-In-Time Debugger > Runtime analysis: test coverage © Marcus Denker
  • 15. Problems of ByteSurgeon > Performance — Faster then code / AST — But installation takes some time > Abstractions too low level — Bytecode — We want to abstract away from bytecode and talk about instance variable access, message sending... — Not a good meta model © Marcus Denker
  • 16. Geppetto > Framework for behavioral reflection > Build on top of ByteSurgeon — but abstracts from bytecode > Fine grained scoping of reflection — spatial (where? and what?) — temporal (when?) > Based on the Reflex Model (Eric Tanter) © Marcus Denker
  • 17. Geppetto: Big Picture AOP Tracer ....... Geppetto ByteSurgeon Squeak © Marcus Denker
  • 18. Geppetto: Modell Reflex (Tanter OOPSLA 03) © Marcus Denker
  • 19. Problem with Bytecode in Geppetto > Bytecode is not a good meta model > Lots of management infrastructure is needed — Hook composition — Synthesised elements (hooks) vs. original code — Mapping to source elements > Bytecode is optimized — e.g. no ifTrue: © Marcus Denker
  • 20. Beyond Text: A Meta Model for Methods > We need a high-level meta model for methods > This model needs to be causally connected — edit the model --> edit the system > Text and Byte- (Binary-) code generated on demand © Marcus Denker
  • 21. Beyond Text: A Meta Model for Methods > Structure of method is implicit — Compile text (to AST) — Decompile bytecode (to IR or AST) > Both text and bytecode are pretty low level > Not suited for being the main representation — How to annotate text? — How to tag synthesised bytecode? > Possible Model: AST © Marcus Denker
  • 22. Many users Aspects Refactoring JIT Method Editor Meta Model (pretty printer) Pluggable Typesystem Annotations Reflection © Marcus Denker
  • 23. Explorations... > Annotation framework — Nodes can be annotated — We can have any object as a (non-textual) annotation > replace ByteSurgeon by AST based transformer > Idea: Behavioral Reflection with Annotations > Combine with AspectS for dynamic Aspects © Marcus Denker
  • 24. Conclusion > We have had a quick intro in Reflection — Squeak and how it enables reflection > How to realize behavioral reflection — Bytesurgeon and Geppetto — Problems > We need a Meta Model for Methods © Marcus Denker
  • 25. License > http://creativecommons.org/licenses/by-sa/2.5/ Attribution-ShareAlike 2.5 You are free: • to copy, distribute, display, and perform the work • to make derivative works • to make commercial use of the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. • For any reuse or distribution, you must make clear to others the license terms of this work. • Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. © Marcus Denker