SlideShare una empresa de Scribd logo
1 de 40
Descargar para leer sin conexión
PHANtom:
A Modern Aspect Language for Pharo
Johan Fabry, Daniel Galdames. PLEIAD Lab, DCC - Universidad de Chile
AOP ??




  Johan Fabry   2
AOP ??

 Cross-cutting concerns
 Aspect = module
  ‣ Behavior = WHAT = advice
  ‣ Quantification = WHEN = pointcuts
 Running application = stream of join points
  ‣ ST computation = messages
  ‣ In PHANtom: method exec

   Johan Fabry                                 2
AOP ??

 Cross-cutting concerns
 Aspect = module
  ‣ Behavior = WHAT = advice
  ‣ Quantification = WHEN = pointcuts
 Running application = stream of join points
  ‣ ST computation = messages
  ‣ In PHANtom: method exec

   Johan Fabry                                 2
AOP ??

 Cross-cutting concerns
 Aspect = module
  ‣ Behavior = WHAT = advice
  ‣ Quantification = WHEN = pointcuts
 Running application = stream of join points
  ‣ ST computation = messages
  ‣ In PHANtom: method exec

   Johan Fabry                                 2
AOP ??

 Cross-cutting concerns
 Aspect = module
  ‣ Behavior = WHAT = advice
  ‣ Quantification = WHEN = pointcuts
 Running application = stream of join points
  ‣ ST computation = messages
  ‣ In PHANtom: method exec

   Johan Fabry                                 2
AOP ??

 Cross-cutting concerns
 Aspect = module
  ‣ Behavior = WHAT = advice
  ‣ Quantification = WHEN = pointcuts
 Running application = stream of join points
  ‣ ST computation = messages
  ‣ In PHANtom: method exec

   Johan Fabry                                 2
In the spirit of Smalltalk

                 Dynamic




       Simple              Powerful


   Johan Fabry                        3
In the spirit of Smalltalk

                        Dynamic
                 Dynamic AOP




       Simple                     Powerful


   Johan Fabry                               3
In the spirit of Smalltalk

                        Dynamic
                 Dynamic AOP   Develop normally




       Simple                           Powerful


   Johan Fabry                                     3
In the spirit of Smalltalk

                        Dynamic
                 Dynamic AOP   Develop normally




       Simple                           Powerful
       Minimal set of Constructs


   Johan Fabry                                     3
In the spirit of Smalltalk

                        Dynamic
                 Dynamic AOP   Develop normally




       Simple                           Powerful
       Minimal set of Constructs
       Uniform / no restrictions

   Johan Fabry                                     3
In the spirit of Smalltalk

                        Dynamic
                 Dynamic AOP   Develop normally




       Simple                           Powerful
       Minimal set of Constructs        First-class everything
       Uniform / no restrictions

   Johan Fabry                                                   3
In the spirit of Smalltalk

                        Dynamic
                 Dynamic AOP   Develop normally




       Simple                           Powerful
       Minimal set of Constructs        First-class everything
       Uniform / no restrictions        New language features

   Johan Fabry                                              3
Pointcuts




                       Dyn



                 Sim         Pow
   Johan Fabry                4
Pointcuts

  PhPointcut receivers: 'TestCase'
      selectors: 'assert:'




                                           Dyn



                                     Sim         Pow
   Johan Fabry                                    4
Pointcuts

  PhPointcut receivers: 'TestCase'
      selectors: 'assert:'

  PhPointcut receivers: 'TestCase+'
      selectors: #(assert: assert:equals:)




                                            Dyn



                                      Sim         Pow
   Johan Fabry                                     4
Pointcuts

  PhPointcut receivers: 'TestCase'
      selectors: 'assert:'

  PhPointcut receivers: 'TestCase+'
      selectors: #(assert: assert:equals:)
      context: #(receiver sender arguments)




                                            Dyn



                                      Sim         Pow
   Johan Fabry                                     4
Pointcuts

  PhPointcut receivers: 'TestCase'
      selectors: 'assert:'

  PhPointcut receivers: 'TestCase+'
      selectors: #(assert: assert:equals:)
      context: #(receiver sender arguments)

  PhPointcut receivers: 'Test*'
      selectors: #(assert: assert:_:
                    assert:_:_:)
                                             Dyn
      context: #(receiver)
      restrict: #(Tests_Mine)
                                       Sim         Pow
   Johan Fabry                                      4
Advice




                      Dyn



                Sim         Pow
  Johan Fabry                5
Advice
 PhAdvice pointcut: pc
     send: #incCount: to: self
     type: #after




                                       Dyn



                                 Sim         Pow
  Johan Fabry                                 5
Advice
 PhAdvice pointcut: pc
     send: #incCount: to: self
     type: #after




 PhAdvice pointcut: pc
     advice: [:ctx |
         Transcript show:
             (ctx receiver asString);cr.
         ctx proceed.]]                Dyn
     type: #around.
                                     Sim     Pow
  Johan Fabry                                 5
Inter-Type Declaration




                               Dyn



                         Sim         Pow
   Johan Fabry                        6
Inter-Type Declaration

  PhClassModifier on: ACTestCase
      addIV: 'phacount'




                                         Dyn



                                   Sim         Pow
   Johan Fabry                                  6
Inter-Type Declaration

  PhClassModifier on: ACTestCase
      addIV: 'phacount'




  PhClassModifier on: ACTestCase
      addIM: 'phacount
          ↑phacount ifNil: [phacount := 0]'
                                            Dyn



                                      Sim         Pow
   Johan Fabry                                     6
Aspect

 PHAspect subclass: MyAspect ...
 (Object subclass: #PhAspect ...)



 Add PHAdvice and PHClassModifier instances



 Send install to activate

 Send uninstall to deactivate                       Dyn



                                              Sim         Pow
   Johan Fabry                                             7
What happens here?

 |asp|
 asp := PhAspect new add:
  (PhAdvice
     pointcut: (PhPointcut
         receivers: 'Transcript class'
         selectors: 'show:')
     advice: [ Transcript show: 'Have ']
     type: #before).
 asp install.
 Transcript show: 'reentrancy control'; cr



   Johan Fabry                               8
What happens here?

 |asp|
 asp := PhAspect new add:
  (PhAdvice
     pointcut: (PhPointcut
         receivers: 'Transcript class'
         selectors: 'show:')
     advice: [ Transcript show: 'Have ']
     type: #before).
 asp install.
 Transcript show: 'reentrancy control'; cr



   Johan Fabry                               8
What happens here?

 |asp|
 asp := PhAspect new add:
  (PhAdvice
     pointcut: (PhPointcut
         receivers: 'Transcript class'
         selectors: 'show:')
     advice: [ Transcript show: 'Have ']
     type: #before).
 asp install.
 Transcript show: 'reentrancy control'; cr



   Johan Fabry                               8
What happens here?

 |asp|
 asp := PhAspect new add:
  (PhAdvice
     pointcut: (PhPointcut
         receivers: 'Transcript class'
         selectors: 'show:')
     advice: [ Transcript show: 'Have ']
     type: #before).
 asp install.
 Transcript show: 'reentrancy control'; cr



   Johan Fabry                               8
What happens here?

 |asp|
 asp := PhAspect new add:
  (PhAdvice
     pointcut: (PhPointcut
         receivers: 'Transcript class'
         selectors: 'show:')
     advice: [ Transcript show: 'Have ']
     type: #before).
 asp install.
 Transcript show: 'reentrancy control'; cr



   Johan Fabry                               8
What happens here?

 |asp|
 asp := PhAspect new add:
  (PhAdvice
     pointcut: (PhPointcut
         receivers: 'Transcript class'
         selectors: 'show:')
     advice: [ Transcript show: 'Have ']
     type: #before).
 asp install.
 Transcript show: 'reentrancy control'; cr



   Johan Fabry                               8
What happens here?

 |asp|
 asp := PhAspect new add:
  (PhAdvice
     pointcut: (PhPointcut
         receivers: 'Transcript class'
         selectors: 'show:')
     advice: [ Transcript show: 'Have ']
     type: #before).
 asp install.
 Transcript show: 'reentrancy control'; cr



   Johan Fabry                               8
What happens here?

 |asp|




                 OM
 asp := PhAspect new add:
  (PhAdvice
     pointcut: (PhPointcut
         receivers: 'Transcript class'
         selectors: 'show:')
     advice: [ Transcript show: 'Have ']
     type: #before).
BO
 asp install.
 Transcript show: 'reentrancy control'; cr



   Johan Fabry                               8
Reentrancy control

 PHANtom: no problem!
  ‣ Aspect execution by default NOT MATCHED



 More power if you want it: Membranes [Tanter & Tabareau]



 Use membranes to control
  ‣ join point emission and capture scope
  ‣ aspect observing join points                         Dyn



                                                   Sim         Pow
   Johan Fabry                                                  9
Advice ordering
 Multiple advice 1 join point

 “Classic”: advice precedence
  ‣ Global and static

 PHANtom deployment precedence
  ‣ Global and ‘static’
  ‣ Complement or override on pointcut

 PHANtom dynamic precedence in the advice
  ‣ OrderedCollection of PHAdvice instances
  ‣ get from context                                Dyn
  ‣ set on context
                                              Sim         Pow
    Johan Fabry                                           10
Not in the paper ...

 TDD
  ‣ 155 tests
  ‣ 90+% coverage




   Johan Fabry         11
Not in the paper ...

 TDD
  ‣ 155 tests
  ‣ 90+% coverage




   Johan Fabry         11
Future work


 Optimize the implementation



 Compile PHANtom code



 Infrastructure for Domain-Specific Aspect Languages




   Johan Fabry                                        12
http://pleiad.cl/PHANtom




Johan Fabry                    13

Más contenido relacionado

Más de ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsESUG
 

Más de ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Último

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 

Último (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 

PHANtom: A Modern Aspect Language for Pharo

  • 1. PHANtom: A Modern Aspect Language for Pharo Johan Fabry, Daniel Galdames. PLEIAD Lab, DCC - Universidad de Chile
  • 2. AOP ?? Johan Fabry 2
  • 3. AOP ?? Cross-cutting concerns Aspect = module ‣ Behavior = WHAT = advice ‣ Quantification = WHEN = pointcuts Running application = stream of join points ‣ ST computation = messages ‣ In PHANtom: method exec Johan Fabry 2
  • 4. AOP ?? Cross-cutting concerns Aspect = module ‣ Behavior = WHAT = advice ‣ Quantification = WHEN = pointcuts Running application = stream of join points ‣ ST computation = messages ‣ In PHANtom: method exec Johan Fabry 2
  • 5. AOP ?? Cross-cutting concerns Aspect = module ‣ Behavior = WHAT = advice ‣ Quantification = WHEN = pointcuts Running application = stream of join points ‣ ST computation = messages ‣ In PHANtom: method exec Johan Fabry 2
  • 6. AOP ?? Cross-cutting concerns Aspect = module ‣ Behavior = WHAT = advice ‣ Quantification = WHEN = pointcuts Running application = stream of join points ‣ ST computation = messages ‣ In PHANtom: method exec Johan Fabry 2
  • 7. AOP ?? Cross-cutting concerns Aspect = module ‣ Behavior = WHAT = advice ‣ Quantification = WHEN = pointcuts Running application = stream of join points ‣ ST computation = messages ‣ In PHANtom: method exec Johan Fabry 2
  • 8. In the spirit of Smalltalk Dynamic Simple Powerful Johan Fabry 3
  • 9. In the spirit of Smalltalk Dynamic Dynamic AOP Simple Powerful Johan Fabry 3
  • 10. In the spirit of Smalltalk Dynamic Dynamic AOP Develop normally Simple Powerful Johan Fabry 3
  • 11. In the spirit of Smalltalk Dynamic Dynamic AOP Develop normally Simple Powerful Minimal set of Constructs Johan Fabry 3
  • 12. In the spirit of Smalltalk Dynamic Dynamic AOP Develop normally Simple Powerful Minimal set of Constructs Uniform / no restrictions Johan Fabry 3
  • 13. In the spirit of Smalltalk Dynamic Dynamic AOP Develop normally Simple Powerful Minimal set of Constructs First-class everything Uniform / no restrictions Johan Fabry 3
  • 14. In the spirit of Smalltalk Dynamic Dynamic AOP Develop normally Simple Powerful Minimal set of Constructs First-class everything Uniform / no restrictions New language features Johan Fabry 3
  • 15. Pointcuts Dyn Sim Pow Johan Fabry 4
  • 16. Pointcuts PhPointcut receivers: 'TestCase' selectors: 'assert:' Dyn Sim Pow Johan Fabry 4
  • 17. Pointcuts PhPointcut receivers: 'TestCase' selectors: 'assert:' PhPointcut receivers: 'TestCase+' selectors: #(assert: assert:equals:) Dyn Sim Pow Johan Fabry 4
  • 18. Pointcuts PhPointcut receivers: 'TestCase' selectors: 'assert:' PhPointcut receivers: 'TestCase+' selectors: #(assert: assert:equals:) context: #(receiver sender arguments) Dyn Sim Pow Johan Fabry 4
  • 19. Pointcuts PhPointcut receivers: 'TestCase' selectors: 'assert:' PhPointcut receivers: 'TestCase+' selectors: #(assert: assert:equals:) context: #(receiver sender arguments) PhPointcut receivers: 'Test*' selectors: #(assert: assert:_: assert:_:_:) Dyn context: #(receiver) restrict: #(Tests_Mine) Sim Pow Johan Fabry 4
  • 20. Advice Dyn Sim Pow Johan Fabry 5
  • 21. Advice PhAdvice pointcut: pc send: #incCount: to: self type: #after Dyn Sim Pow Johan Fabry 5
  • 22. Advice PhAdvice pointcut: pc send: #incCount: to: self type: #after PhAdvice pointcut: pc advice: [:ctx | Transcript show: (ctx receiver asString);cr. ctx proceed.]] Dyn type: #around. Sim Pow Johan Fabry 5
  • 23. Inter-Type Declaration Dyn Sim Pow Johan Fabry 6
  • 24. Inter-Type Declaration PhClassModifier on: ACTestCase addIV: 'phacount' Dyn Sim Pow Johan Fabry 6
  • 25. Inter-Type Declaration PhClassModifier on: ACTestCase addIV: 'phacount' PhClassModifier on: ACTestCase addIM: 'phacount ↑phacount ifNil: [phacount := 0]' Dyn Sim Pow Johan Fabry 6
  • 26. Aspect PHAspect subclass: MyAspect ... (Object subclass: #PhAspect ...) Add PHAdvice and PHClassModifier instances Send install to activate Send uninstall to deactivate Dyn Sim Pow Johan Fabry 7
  • 27. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: 'Transcript class' selectors: 'show:') advice: [ Transcript show: 'Have '] type: #before). asp install. Transcript show: 'reentrancy control'; cr Johan Fabry 8
  • 28. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: 'Transcript class' selectors: 'show:') advice: [ Transcript show: 'Have '] type: #before). asp install. Transcript show: 'reentrancy control'; cr Johan Fabry 8
  • 29. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: 'Transcript class' selectors: 'show:') advice: [ Transcript show: 'Have '] type: #before). asp install. Transcript show: 'reentrancy control'; cr Johan Fabry 8
  • 30. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: 'Transcript class' selectors: 'show:') advice: [ Transcript show: 'Have '] type: #before). asp install. Transcript show: 'reentrancy control'; cr Johan Fabry 8
  • 31. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: 'Transcript class' selectors: 'show:') advice: [ Transcript show: 'Have '] type: #before). asp install. Transcript show: 'reentrancy control'; cr Johan Fabry 8
  • 32. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: 'Transcript class' selectors: 'show:') advice: [ Transcript show: 'Have '] type: #before). asp install. Transcript show: 'reentrancy control'; cr Johan Fabry 8
  • 33. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: 'Transcript class' selectors: 'show:') advice: [ Transcript show: 'Have '] type: #before). asp install. Transcript show: 'reentrancy control'; cr Johan Fabry 8
  • 34. What happens here? |asp| OM asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: 'Transcript class' selectors: 'show:') advice: [ Transcript show: 'Have '] type: #before). BO asp install. Transcript show: 'reentrancy control'; cr Johan Fabry 8
  • 35. Reentrancy control PHANtom: no problem! ‣ Aspect execution by default NOT MATCHED More power if you want it: Membranes [Tanter & Tabareau] Use membranes to control ‣ join point emission and capture scope ‣ aspect observing join points Dyn Sim Pow Johan Fabry 9
  • 36. Advice ordering Multiple advice 1 join point “Classic”: advice precedence ‣ Global and static PHANtom deployment precedence ‣ Global and ‘static’ ‣ Complement or override on pointcut PHANtom dynamic precedence in the advice ‣ OrderedCollection of PHAdvice instances ‣ get from context Dyn ‣ set on context Sim Pow Johan Fabry 10
  • 37. Not in the paper ... TDD ‣ 155 tests ‣ 90+% coverage Johan Fabry 11
  • 38. Not in the paper ... TDD ‣ 155 tests ‣ 90+% coverage Johan Fabry 11
  • 39. Future work Optimize the implementation Compile PHANtom code Infrastructure for Domain-Specific Aspect Languages Johan Fabry 12