Understanding Pharo’s global state 
to move programs 
through time and space 
Guillermo Polito, Noury Bouraqadi, Stéphane ...
The problem: 
moving code around 
environment I environment II 
(another time, another machine) 
MyLogger 
MyCache 
Tuesda...
The problem: 
moving code around 
environment I environment II 
(another time, another machine) 
MyLogger 
MyCache 
Tuesda...
The problem: 
moving code around 
environment I environment II 
(another time, another machine) 
MyLogger 
MyCache 
MyLogg...
The problem: 
moving code with global state around 
• should global state be reinitialized? 
• should it be kept and moved...
The main challenge (by example): 
non-explicitness 
WeakIdentityKeyDictionary subclass: #ASTCache 
classVariableNames: ’De...
The need: 
Understanding 
the global state 
Tuesday 19 August 14
A classification 
Category # 
Constants 1722 
Settings 236 
Singletons 65 
Graphical Res. 47 
Caches 43 
Registries 31 
Se...
Some possible solutions 
• Reification of implicit elements 
• Moving responsibilities to the language 
Tuesday 19 August ...
Reification provides with 
• Explicitness 
• Unified APIs 
• Frameworks and libraries can profit from it 
(particularly co...
Moving responsibilities 
to the language 
• So the system can introspect itself 
• Modify itself 
• And control itself 
E....
Understanding Pharo’s global state 
to move programs 
through time and space 
• A classification of global state usage 
• ...
Upcoming SlideShare
Loading in …5
×

Understanding Pharo’s global state

566 views

Published on

Understanding Pharo’s global state
IWST 2014 at ESUG, Cambridge

Published in: Software
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
566
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Understanding Pharo’s global state

  1. 1. Understanding Pharo’s global state to move programs through time and space Guillermo Polito, Noury Bouraqadi, Stéphane Ducasse, Luc Fabresse Ecole des Mines de Douai, RMoD/Inria Stéphane Ducasse IWST 2014, ESUG, Cambridge Tuesday 19 August 14
  2. 2. The problem: moving code around environment I environment II (another time, another machine) MyLogger MyCache Tuesday 19 August 14
  3. 3. The problem: moving code around environment I environment II (another time, another machine) MyLogger MyCache Tuesday 19 August 14
  4. 4. The problem: moving code around environment I environment II (another time, another machine) MyLogger MyCache MyLogger MyCache Tuesday 19 August 14
  5. 5. The problem: moving code with global state around • should global state be reinitialized? • should it be kept and moved as well? • should it be rebound to some already existing object? Tuesday 19 August 14
  6. 6. The main challenge (by example): non-explicitness WeakIdentityKeyDictionary subclass: #ASTCache classVariableNames: ’Default’. ASTCache>>at: aCompiledMethod ^ self at: aCompiledMethod ifAbsentPut: [ self newASTFor: aCompiledMethod ]. ASTCache>>newASTFor: aMethod "creation of the AST..." ASTCache>>reset self removeAll. ASTCache class>>default ^ Default ifNil: [ Default := self new ]. ASTCache class>>shutDown self default reset. • Ad-hoc implementation of a cache => no clear API • It’s incomplete (e.g., lack support for a recycling strategy) => each cache implements its own features • We know it is a cache just because of the class name => no programatic way to identify it Tuesday 19 August 14
  7. 7. The need: Understanding the global state Tuesday 19 August 14
  8. 8. A classification Category # Constants 1722 Settings 236 Singletons 65 Graphical Res. 47 Caches 43 Registries 31 Session Specific 27 Process Controllers 11 Finalizables 6 Tuesday 19 August 14
  9. 9. Some possible solutions • Reification of implicit elements • Moving responsibilities to the language Tuesday 19 August 14
  10. 10. Reification provides with • Explicitness • Unified APIs • Frameworks and libraries can profit from it (particularly code-migration ones) E.g., first class instance variables, first class processes, first class caches Tuesday 19 August 14
  11. 11. Moving responsibilities to the language • So the system can introspect itself • Modify itself • And control itself E.g., flush caches on low memory Tuesday 19 August 14
  12. 12. Understanding Pharo’s global state to move programs through time and space • A classification of global state usage • Detected a need for reification • Detected a need for moving some responsibilities to the language Guillermo Polito, Noury Bouraqadi, Stéphane Ducasse, Luc Fabresse Ecole des Mines de Douai, RMoD/Inria Tuesday 19 August 14

×