SlideShare a Scribd company logo
1 of 38
Download to read offline
Calypso underhood
http://pharo.org
http://rmod.inria.fr
Denis Kudriashov dionisiydk@gmail.com https://github.com/dionisiydk/Calypso
Navigation model
• First class scopes
• PackageScope
• ClassScope
• MethodScope
First class scopes
• Select scope from navigation environment
scope := ClySystemNavigationEnvironment currentImage
selectScope: ClyClassScope of: {Collection. Set}
• SystemScope represents global environment space
ClySystemNavigationEnvironment currentImageScope
Navigation model
• First class scopes
• First class queries
• MessageSenders
• ClassReferences
First class queries
• Evaluate query in scope
scope query: (ClyMessageSenders of: #(do:))
scope query: (ClyMessageImplementors of: #(do:))
Navigation model
• First class scopes
• First class queries
• First class query results
• SortedClasses
• HierarchicallySortedClasses
First class query results
• Specify what kind of result should be built by query
scope query: (ClyMessageSenders of: #(do:) as: ClyHierarchicallySortedMethods)
• Retrieve all available items with simple query
scope query: ClySortedMethods
scope query: ClyHierarchicallySortedMethods
Navigation model
• First class scopes
• First class queries
• First class query results
• Query result is accessed by cursor instance
Any query returns cursor
• Cursor provides stream access to underlying query
result
• caches portion of result items
• loads new portion on demand
• only cached items compute properties
• In remote scenario only cursor with cached items is
transferred to client
Cursor provides subsequent
query API
packageCursor := ClySystemNavigationEnvironment
queryCurrentImageFor: ClySortedPackages.
classCursor := packageCursor query: ClySortedClasses from: {#Kernel asPackage}.
classCursor := classesCursor query: ClyHierarchicallySortedClasses.
classCursor := classesCursor queryContentInScopeWith: 'AST-Core' asPackage.
classCursor := classesCursor queryContentInScopeWithout: 'Kernel' asPackage.
methodCursor := classCursor query: ClySortedMethods from: {Point. Array}.
methodCursor := methodCursor queryContentInNewScope: ClyClassSideScope.
Browser navigation state
• Cursors incapsulate main navigation state of the browser:
• what kind of query it represents
• method group mode or variable mode
• in what scope result is shown
• instance side or class side
• inherited method visibility
• what kind of result is used
• flat methods or hierarchical methods
Browser navigation state
• No special flags like in old browser
Navigation model
• First class scopes
• First class queries
• First class query results
• Query result is accessed by cursor instance
• Result items wrap and extend actual objects
(classes, methods) with properties
Actual query result is
collection of environment items
• Environment item wraps actual object and extends it with properties:
• position in query result
• depth in query result
• domain specific properties
• ClyAbstractClassTag
• ClyOverridenMethodTag
• Environment plugins can extend properties of particular items
• ClyInheritanceAnalyzerEnvironmentPlugin marks abstract classes with
ClyAbstractClassTag
• Properties are computed lazily for portion of requested items
• it can be slow to retrieve them
Navigation model
• First class scopes
• First class queries
• First class query results
• Query result is accessed by cursor instance
• Result items wrap and extend actual objects
(classes, methods) with properties
Browser navigation views
• All navigation views are based on fast table
• Special data source based on cursor
• Only visible part of table is requested from cursor
• which is covered by cursor cache
• Data source describes tree structure
• what query to use to expand each kind of item
Browser navigation views
cursor := ClySystemNavigationEnvironment
queryCurrentImageFor: ClySortedPackages.
dataSource := ClyCollapsedDataSource on: cursor.
dataSource childrenStructure: {
ClyPackageScope -> ClySortedClassGroups.
ClyClassGroupScope -> ClyHierarchicallySortedClasses}.
table := FTTableMorph new.
table
extent: 200 @ 400;
dataSource: dataSource;
openInWindow.
Browser navigation views
cursor := ClySystemNavigationEnvironment
queryCurrentImageFor: ClySortedPackages.
dataSource := ClyCollapsedDataSource on: cursor.
dataSource childrenStructure: {
ClyPackageScope -> ClySortedClassGroups.
ClyClassGroupScope -> ClyHierarchicallySortedClasses}.
table := FTTableMorph new.
table
extent: 200 @ 400;
dataSource: dataSource;
openInWindow.
Demo
Browser item selection
• First class selection represents selected objects
• ClyDataSourceSelection represents manually selected items
• ClyDataSourceHighlighting represents highlighted items
• to highlight groups of selected methods
• ClyDesiredSelection responsible to restore selected items
when data source is changed
• automatic selection of same method when new class
selected
• Selections maintain correct visible state after any changes
Navigation history
• Collection of browser states
• state of all navigation views
• data source detached from model
• selection
• active tabs
• window to support across window navigation
• Specific browser state
• list of scopes in method browser
How extend browser?
• Commands
Commander
• Calypso commands are based on Commander
• Every command is first class object subclass of CmdCommand with execute method
• Multiple activators can be attached to command class to declare specific way to
access command from particular application context
• CmdContextMenuCommandActivator
• CmdShortcutCommandActivator
• CmdDragAndDropCommandActivator
• ClyToolbarCommandActivator (for elements from browser toolbar)
• ClyTableIconCommandActivator (to support method icons of Nautilus)
• More http://dionisiydk.blogspot.fr/2017/04/commander-command-pattern-library.html
Command example
RenamePackageCommand>>execute
package renameTo: newName
RenamePackageCommand class>>systemBrowserShortcutActivator
<commandActivator>
^CmdShortcutCommandActivator by: $r meta for: ClyPackageSystemBrowserContext
RenamePackageCommand class>>systemBrowserMenuActivator
<commandActivator>
^CmdContextMenuCommandActivator byRootGroupItemFor: ClyPackageSystemBrowserContext
RenamePackageCommand>>defaultMenuItemName
^'Rename'
Command example
RenamePackageCommand>>prepareFullExecutionInContext: aToolContext
super prepareFullExecutionInContext: aToolContext.
package := aToolContext lastSelectedPackage.
newName := UIManager default
request: 'New name of the package'
initialAnswer: package name
title: 'Rename a package'.
newName isEmptyOrNil | (newName = package name)
ifTrue: [ ^ CmdCommandAborted signal ]
RenamePackageCommand>>canBeExecutedInContext: aToolContext
^aToolContext isPackageSelected
Drag and drop example
MoveClassToPackageCommand>>execute
classes do: [:each | package addClass: each]
MoveClassToPackageCommand class>>systemBrowserDragAndDropActivator
<commandActivator>
^CmdDragAndDropCommandActivator
for: ClyClassSystemBrowserContext toDropIn: ClyPackageSystemBrowserContext
MoveClassToPackageCommand>>prepareExecutionInDragContext: aToolContext
super prepareExecutionInDragContext: aToolContext.
classes := aToolContext selectedClasses
MoveClassToPackageCommand>>prepareExecutionInDropContext: aToolContext
super prepareExecutionInDropContext: aToolContext.
package := aToolContext lastSelectedPackage
How extend browser?
• Commands
• Table decoration
Table decoration
• ClyTableDecorator subclasses with class side methods
ClyAbstractClassTableDecorator class>>browserContextClass
^ClyClassSystemBrowserContext
ClyAbstractClassTableDecorator class>>wantsDecorateTableCellOf: aDataSourceItem
^aDataSourceItem isMarkedWith: ClyAbstractClassTag
ClyAbstractClassTableDecorator class>>decorateTableCell: anItemCellMorph of: aDataSourceItem
| nameMorph |
nameMorph := anItemCellMorph nameMorph.
nameMorph emphasis: TextEmphasis italic emphasisCode.
nameMorph color: nameMorph color contrastingColorAdjustment contrastingColorAdjustment
Table decoration
• Commands with ClyTableIconCommandActivator
RunTestMethodCommand class>>systemBrowserTableIconActivator
<commandActivator>
^ClyTableIconCommandActivator for: ClyMethodSystemBrowserContext
RunTestMethodCommand >>buildTableCellIconFor: anItemCellMorph
testMethod isPassedTest ifTrue: [^anItemCellMorph iconNamed: #testGreenIcon].
testMethod isErrorTest ifTrue: [^anItemCellMorph iconNamed: #testRedIcon].
testMethod isFailedTest ifTrue: [^anItemCellMorph iconNamed: #testYellowIcon].
^anItemCellMorph iconNamed: #testNotRunIcon
How extend browser?
• Commands
• Table decoration
• Browser tabs
Browser tabs
• Calypso provides multiple tools instead of single source code view
• ClyClassCreationTool
• ClyClassCommentEditorTool
• ClyClassDefinitionEditorTool
• ClyMethodCreationTool
• ClyMethodCodeEditorTool
• Tools are managed by tabs
• Tools are built in background due to nice TabsManager package
Browser tabs
• Tools are subclasses of ClyBrowserTool with #build method and
activation context where they should be applied
ClyMethodDiffTool>>build
diffMorph := DiffMorph from: self leftMethod sourceCode to: self rightMethod sourceCode.
diffMorph
contextClass: self rightMethod sourceCode;
hResizing: #spaceFill;
vResizing: #spaceFill;
showOptions: false.
self addMorph: diffMorph fullFrame: LayoutFrame identity
ClyMethodDiffTool class>>activationContextClass
^ClyMethodSystemBrowserContext
ClyMethodDiffTool class>>shouldBeActivatedInContext: aBrowserContext
^aBrowserContext selectedMethods size > 1
How extend browser?
• Commands
• Table decoration
• Browser tabs
• Method groups
Method groups
• Third panel in browser shows method groups
• TaggedMethodGroups based on method tags (protocols)
• NoTagMethodGroup for unclassified methods
• ExtendedMethodGroup for all class extensions
• InheritedMethodGroup to toggle all inherited methods visibility
• SuperclassMethodGroup to toggle concrete superclass methods visibility
• ExternalPackageGroup for concrete package extending class
• VariableMethodGroup for variables mode of browser
• more
Method groups
• Method groups are built by method group providers
• Group providers are extended by environment plugins
ClyInheritanceAnalyzerEnvironmentPlugin>>collectMethodGroupProvidersFor: classes
^{ClyAbstractMethodGroupProvider. ClyOverrideMethodGroupProvider.
ClyOverriddenMethodGroupProvider. ClyRequiredMethodGroupProvider}
collect: [ :each | each classes: classes]
ClyAbstractMethodGroupProvider>>buildGroupItemsOn: items
(classes anySatisfy: [ :each | each hasAbstractMethods ])
ifFalse: [ ^self ].
items add: (ClyAbstractMethodGroup classes: classes) asEnvironmentItem
ClyAbstractMethodGroup>>includesMethod: aMethod
^aMethod sendsSelector: #subclassResponsibility
How extend browser?
• Commands
• Table decoration
• Browser tabs
• Method groups
• Class groups
Class groups
• First panel in browser shows packages expanded
to class groups
• TaggedClassGroup based of class tags
(RPackageTag)
• NoTagClassGroup for unclassified classes
• ExtendedClassGroup for classes extended by
current package
Class groups
• Class groups are built by class group providers
• Group providers are extended by environment
plugins
ClySystemEnvironmentPlugin>>collectClassGroupProvidersFor: aPackage
^{ClyExtendedClassGroupProvider. ClyTaggedClassGroupProvider}
collect: [ :each | each package: aPackage ]
ClyExtendedClassGroupProvider>>buildGroupItemsOn: items
package extendedClassNames ifEmpty: [ ^self ].
items add: (ClyExtendedClassGroup in: package) asEnvironmentItem
The end

More Related Content

What's hot

XML London 2013 - Architecture of xproc.xq an XProc processor
XML London 2013 - Architecture of xproc.xq an XProc processorXML London 2013 - Architecture of xproc.xq an XProc processor
XML London 2013 - Architecture of xproc.xq an XProc processor
jimfuller2009
 
Java class loading tips and tricks - Java Colombo Meetup, January, 2014
Java class loading  tips and tricks - Java Colombo Meetup, January, 2014Java class loading  tips and tricks - Java Colombo Meetup, January, 2014
Java class loading tips and tricks - Java Colombo Meetup, January, 2014
Sameera Jayasoma
 
Java tutorials
Java tutorialsJava tutorials
Java tutorials
saryu2011
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
yohanbeschi
 

What's hot (19)

Java
JavaJava
Java
 
Java
JavaJava
Java
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Understanding Java Dynamic Proxies
Understanding Java Dynamic ProxiesUnderstanding Java Dynamic Proxies
Understanding Java Dynamic Proxies
 
Metamodeling of custom Pharo images
 Metamodeling of custom Pharo images Metamodeling of custom Pharo images
Metamodeling of custom Pharo images
 
Java and the JVM
Java and the JVMJava and the JVM
Java and the JVM
 
Scala presentationjune112011
Scala presentationjune112011Scala presentationjune112011
Scala presentationjune112011
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)
 
core java programming
core java programmingcore java programming
core java programming
 
XML London 2013 - Architecture of xproc.xq an XProc processor
XML London 2013 - Architecture of xproc.xq an XProc processorXML London 2013 - Architecture of xproc.xq an XProc processor
XML London 2013 - Architecture of xproc.xq an XProc processor
 
Understanding ClassLoaders
Understanding ClassLoadersUnderstanding ClassLoaders
Understanding ClassLoaders
 
Java
JavaJava
Java
 
Java 102 intro to object-oriented programming in java - exercises
Java 102   intro to object-oriented programming in java - exercisesJava 102   intro to object-oriented programming in java - exercises
Java 102 intro to object-oriented programming in java - exercises
 
Java class loading tips and tricks - Java Colombo Meetup, January, 2014
Java class loading  tips and tricks - Java Colombo Meetup, January, 2014Java class loading  tips and tricks - Java Colombo Meetup, January, 2014
Java class loading tips and tricks - Java Colombo Meetup, January, 2014
 
Java tutorials
Java tutorialsJava tutorials
Java tutorials
 
Php unit for drupal 8
Php unit for drupal 8Php unit for drupal 8
Php unit for drupal 8
 
Java 102 intro to object-oriented programming in java
Java 102   intro to object-oriented programming in javaJava 102   intro to object-oriented programming in java
Java 102 intro to object-oriented programming in java
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practices
 

Similar to Calypso underhood

Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGent
kevinvw
 
td_mxc_rubyrails_shin
td_mxc_rubyrails_shintd_mxc_rubyrails_shin
td_mxc_rubyrails_shin
tutorialsruby
 
td_mxc_rubyrails_shin
td_mxc_rubyrails_shintd_mxc_rubyrails_shin
td_mxc_rubyrails_shin
tutorialsruby
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
WO Community
 
Java lec class, objects and constructors
Java lec class, objects and constructorsJava lec class, objects and constructors
Java lec class, objects and constructors
Jan Niño Acierto
 

Similar to Calypso underhood (20)

Calypso Browser
Calypso BrowserCalypso Browser
Calypso Browser
 
Calypso browser
Calypso browserCalypso browser
Calypso browser
 
VB.net&OOP.pptx
VB.net&OOP.pptxVB.net&OOP.pptx
VB.net&OOP.pptx
 
Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGent
 
SystemVerilog_Classes.pdf
SystemVerilog_Classes.pdfSystemVerilog_Classes.pdf
SystemVerilog_Classes.pdf
 
CodeIgniter & MVC
CodeIgniter & MVCCodeIgniter & MVC
CodeIgniter & MVC
 
td_mxc_rubyrails_shin
td_mxc_rubyrails_shintd_mxc_rubyrails_shin
td_mxc_rubyrails_shin
 
td_mxc_rubyrails_shin
td_mxc_rubyrails_shintd_mxc_rubyrails_shin
td_mxc_rubyrails_shin
 
Java
JavaJava
Java
 
Chap01
Chap01Chap01
Chap01
 
Java2
Java2Java2
Java2
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojo
 
Selenium WebDriver with Java
Selenium WebDriver with JavaSelenium WebDriver with Java
Selenium WebDriver with Java
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
 
Java lec class, objects and constructors
Java lec class, objects and constructorsJava lec class, objects and constructors
Java lec class, objects and constructors
 
springdatajpa-up.pdf
springdatajpa-up.pdfspringdatajpa-up.pdf
springdatajpa-up.pdf
 
Filtering, Searching, and Sorting ActiveRecord Lists Using Filterrific
Filtering, Searching, and Sorting ActiveRecord Lists Using FilterrificFiltering, Searching, and Sorting ActiveRecord Lists Using Filterrific
Filtering, Searching, and Sorting ActiveRecord Lists Using Filterrific
 
Introduction to Monsoon PHP framework
Introduction to Monsoon PHP frameworkIntroduction to Monsoon PHP framework
Introduction to Monsoon PHP framework
 
06.1 .Net memory management
06.1 .Net memory management06.1 .Net memory management
06.1 .Net memory management
 
CSS workshop @ OutSystems
CSS workshop @ OutSystemsCSS workshop @ OutSystems
CSS workshop @ OutSystems
 

More from 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 programming
ESUG
 
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
ESUG
 
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 results
ESUG
 
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
ESUG
 
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
ESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
ESUG
 
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
ESUG
 
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
ESUG
 
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
ESUG
 
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
ESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
ESUG
 
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
ESUG
 

More from 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
 

Recently uploaded

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Recently uploaded (20)

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 

Calypso underhood

  • 1. Calypso underhood http://pharo.org http://rmod.inria.fr Denis Kudriashov dionisiydk@gmail.com https://github.com/dionisiydk/Calypso
  • 2. Navigation model • First class scopes • PackageScope • ClassScope • MethodScope
  • 3. First class scopes • Select scope from navigation environment scope := ClySystemNavigationEnvironment currentImage selectScope: ClyClassScope of: {Collection. Set} • SystemScope represents global environment space ClySystemNavigationEnvironment currentImageScope
  • 4. Navigation model • First class scopes • First class queries • MessageSenders • ClassReferences
  • 5. First class queries • Evaluate query in scope scope query: (ClyMessageSenders of: #(do:)) scope query: (ClyMessageImplementors of: #(do:))
  • 6. Navigation model • First class scopes • First class queries • First class query results • SortedClasses • HierarchicallySortedClasses
  • 7. First class query results • Specify what kind of result should be built by query scope query: (ClyMessageSenders of: #(do:) as: ClyHierarchicallySortedMethods) • Retrieve all available items with simple query scope query: ClySortedMethods scope query: ClyHierarchicallySortedMethods
  • 8. Navigation model • First class scopes • First class queries • First class query results • Query result is accessed by cursor instance
  • 9. Any query returns cursor • Cursor provides stream access to underlying query result • caches portion of result items • loads new portion on demand • only cached items compute properties • In remote scenario only cursor with cached items is transferred to client
  • 10. Cursor provides subsequent query API packageCursor := ClySystemNavigationEnvironment queryCurrentImageFor: ClySortedPackages. classCursor := packageCursor query: ClySortedClasses from: {#Kernel asPackage}. classCursor := classesCursor query: ClyHierarchicallySortedClasses. classCursor := classesCursor queryContentInScopeWith: 'AST-Core' asPackage. classCursor := classesCursor queryContentInScopeWithout: 'Kernel' asPackage. methodCursor := classCursor query: ClySortedMethods from: {Point. Array}. methodCursor := methodCursor queryContentInNewScope: ClyClassSideScope.
  • 11. Browser navigation state • Cursors incapsulate main navigation state of the browser: • what kind of query it represents • method group mode or variable mode • in what scope result is shown • instance side or class side • inherited method visibility • what kind of result is used • flat methods or hierarchical methods
  • 12. Browser navigation state • No special flags like in old browser
  • 13. Navigation model • First class scopes • First class queries • First class query results • Query result is accessed by cursor instance • Result items wrap and extend actual objects (classes, methods) with properties
  • 14. Actual query result is collection of environment items • Environment item wraps actual object and extends it with properties: • position in query result • depth in query result • domain specific properties • ClyAbstractClassTag • ClyOverridenMethodTag • Environment plugins can extend properties of particular items • ClyInheritanceAnalyzerEnvironmentPlugin marks abstract classes with ClyAbstractClassTag • Properties are computed lazily for portion of requested items • it can be slow to retrieve them
  • 15. Navigation model • First class scopes • First class queries • First class query results • Query result is accessed by cursor instance • Result items wrap and extend actual objects (classes, methods) with properties
  • 16. Browser navigation views • All navigation views are based on fast table • Special data source based on cursor • Only visible part of table is requested from cursor • which is covered by cursor cache • Data source describes tree structure • what query to use to expand each kind of item
  • 17. Browser navigation views cursor := ClySystemNavigationEnvironment queryCurrentImageFor: ClySortedPackages. dataSource := ClyCollapsedDataSource on: cursor. dataSource childrenStructure: { ClyPackageScope -> ClySortedClassGroups. ClyClassGroupScope -> ClyHierarchicallySortedClasses}. table := FTTableMorph new. table extent: 200 @ 400; dataSource: dataSource; openInWindow.
  • 18. Browser navigation views cursor := ClySystemNavigationEnvironment queryCurrentImageFor: ClySortedPackages. dataSource := ClyCollapsedDataSource on: cursor. dataSource childrenStructure: { ClyPackageScope -> ClySortedClassGroups. ClyClassGroupScope -> ClyHierarchicallySortedClasses}. table := FTTableMorph new. table extent: 200 @ 400; dataSource: dataSource; openInWindow. Demo
  • 19. Browser item selection • First class selection represents selected objects • ClyDataSourceSelection represents manually selected items • ClyDataSourceHighlighting represents highlighted items • to highlight groups of selected methods • ClyDesiredSelection responsible to restore selected items when data source is changed • automatic selection of same method when new class selected • Selections maintain correct visible state after any changes
  • 20. Navigation history • Collection of browser states • state of all navigation views • data source detached from model • selection • active tabs • window to support across window navigation • Specific browser state • list of scopes in method browser
  • 22. Commander • Calypso commands are based on Commander • Every command is first class object subclass of CmdCommand with execute method • Multiple activators can be attached to command class to declare specific way to access command from particular application context • CmdContextMenuCommandActivator • CmdShortcutCommandActivator • CmdDragAndDropCommandActivator • ClyToolbarCommandActivator (for elements from browser toolbar) • ClyTableIconCommandActivator (to support method icons of Nautilus) • More http://dionisiydk.blogspot.fr/2017/04/commander-command-pattern-library.html
  • 23. Command example RenamePackageCommand>>execute package renameTo: newName RenamePackageCommand class>>systemBrowserShortcutActivator <commandActivator> ^CmdShortcutCommandActivator by: $r meta for: ClyPackageSystemBrowserContext RenamePackageCommand class>>systemBrowserMenuActivator <commandActivator> ^CmdContextMenuCommandActivator byRootGroupItemFor: ClyPackageSystemBrowserContext RenamePackageCommand>>defaultMenuItemName ^'Rename'
  • 24. Command example RenamePackageCommand>>prepareFullExecutionInContext: aToolContext super prepareFullExecutionInContext: aToolContext. package := aToolContext lastSelectedPackage. newName := UIManager default request: 'New name of the package' initialAnswer: package name title: 'Rename a package'. newName isEmptyOrNil | (newName = package name) ifTrue: [ ^ CmdCommandAborted signal ] RenamePackageCommand>>canBeExecutedInContext: aToolContext ^aToolContext isPackageSelected
  • 25. Drag and drop example MoveClassToPackageCommand>>execute classes do: [:each | package addClass: each] MoveClassToPackageCommand class>>systemBrowserDragAndDropActivator <commandActivator> ^CmdDragAndDropCommandActivator for: ClyClassSystemBrowserContext toDropIn: ClyPackageSystemBrowserContext MoveClassToPackageCommand>>prepareExecutionInDragContext: aToolContext super prepareExecutionInDragContext: aToolContext. classes := aToolContext selectedClasses MoveClassToPackageCommand>>prepareExecutionInDropContext: aToolContext super prepareExecutionInDropContext: aToolContext. package := aToolContext lastSelectedPackage
  • 26. How extend browser? • Commands • Table decoration
  • 27. Table decoration • ClyTableDecorator subclasses with class side methods ClyAbstractClassTableDecorator class>>browserContextClass ^ClyClassSystemBrowserContext ClyAbstractClassTableDecorator class>>wantsDecorateTableCellOf: aDataSourceItem ^aDataSourceItem isMarkedWith: ClyAbstractClassTag ClyAbstractClassTableDecorator class>>decorateTableCell: anItemCellMorph of: aDataSourceItem | nameMorph | nameMorph := anItemCellMorph nameMorph. nameMorph emphasis: TextEmphasis italic emphasisCode. nameMorph color: nameMorph color contrastingColorAdjustment contrastingColorAdjustment
  • 28. Table decoration • Commands with ClyTableIconCommandActivator RunTestMethodCommand class>>systemBrowserTableIconActivator <commandActivator> ^ClyTableIconCommandActivator for: ClyMethodSystemBrowserContext RunTestMethodCommand >>buildTableCellIconFor: anItemCellMorph testMethod isPassedTest ifTrue: [^anItemCellMorph iconNamed: #testGreenIcon]. testMethod isErrorTest ifTrue: [^anItemCellMorph iconNamed: #testRedIcon]. testMethod isFailedTest ifTrue: [^anItemCellMorph iconNamed: #testYellowIcon]. ^anItemCellMorph iconNamed: #testNotRunIcon
  • 29. How extend browser? • Commands • Table decoration • Browser tabs
  • 30. Browser tabs • Calypso provides multiple tools instead of single source code view • ClyClassCreationTool • ClyClassCommentEditorTool • ClyClassDefinitionEditorTool • ClyMethodCreationTool • ClyMethodCodeEditorTool • Tools are managed by tabs • Tools are built in background due to nice TabsManager package
  • 31. Browser tabs • Tools are subclasses of ClyBrowserTool with #build method and activation context where they should be applied ClyMethodDiffTool>>build diffMorph := DiffMorph from: self leftMethod sourceCode to: self rightMethod sourceCode. diffMorph contextClass: self rightMethod sourceCode; hResizing: #spaceFill; vResizing: #spaceFill; showOptions: false. self addMorph: diffMorph fullFrame: LayoutFrame identity ClyMethodDiffTool class>>activationContextClass ^ClyMethodSystemBrowserContext ClyMethodDiffTool class>>shouldBeActivatedInContext: aBrowserContext ^aBrowserContext selectedMethods size > 1
  • 32. How extend browser? • Commands • Table decoration • Browser tabs • Method groups
  • 33. Method groups • Third panel in browser shows method groups • TaggedMethodGroups based on method tags (protocols) • NoTagMethodGroup for unclassified methods • ExtendedMethodGroup for all class extensions • InheritedMethodGroup to toggle all inherited methods visibility • SuperclassMethodGroup to toggle concrete superclass methods visibility • ExternalPackageGroup for concrete package extending class • VariableMethodGroup for variables mode of browser • more
  • 34. Method groups • Method groups are built by method group providers • Group providers are extended by environment plugins ClyInheritanceAnalyzerEnvironmentPlugin>>collectMethodGroupProvidersFor: classes ^{ClyAbstractMethodGroupProvider. ClyOverrideMethodGroupProvider. ClyOverriddenMethodGroupProvider. ClyRequiredMethodGroupProvider} collect: [ :each | each classes: classes] ClyAbstractMethodGroupProvider>>buildGroupItemsOn: items (classes anySatisfy: [ :each | each hasAbstractMethods ]) ifFalse: [ ^self ]. items add: (ClyAbstractMethodGroup classes: classes) asEnvironmentItem ClyAbstractMethodGroup>>includesMethod: aMethod ^aMethod sendsSelector: #subclassResponsibility
  • 35. How extend browser? • Commands • Table decoration • Browser tabs • Method groups • Class groups
  • 36. Class groups • First panel in browser shows packages expanded to class groups • TaggedClassGroup based of class tags (RPackageTag) • NoTagClassGroup for unclassified classes • ExtendedClassGroup for classes extended by current package
  • 37. Class groups • Class groups are built by class group providers • Group providers are extended by environment plugins ClySystemEnvironmentPlugin>>collectClassGroupProvidersFor: aPackage ^{ClyExtendedClassGroupProvider. ClyTaggedClassGroupProvider} collect: [ :each | each package: aPackage ] ClyExtendedClassGroupProvider>>buildGroupItemsOn: items package extendedClassNames ifEmpty: [ ^self ]. items add: (ClyExtendedClassGroup in: package) asEnvironmentItem