AD-HOC RUNTIME OBJECT
STRUCTURE VISUALIZATIONS
WITH METALINKS
Peter Uhnak     Robert Pergl
Department of So ware Engineering
Faculty of Information Technology
Czech Technical University in Prague
Czech Republic
{uhnakpet|perglr}@fit.cvut.cz
INSTANCE VISUALIZATIONS
Peter Uhnak     Robert Pergl
Department of So ware Engineering
Faculty of Information Technology
Czech Technical University in Prague
Czech Republic
{uhnakpet|perglr}@fit.cvut.cz
How do we look at the run-time structure of objects?
MAIN MOTIVATION
understanding Spec interpreter (Spec UI construction)
INPUT
ui := DynamicComposableModel new.
ui instantiateModels: #(btn ButtonModel).
ui btn label: 'Button'.
layout := SpecLayout composed
newRow: [ :row | row add: #btn ];
yourself.
ui openWithSpecLayout: layout.
ButtonModel class>>#defaultSpec
<spec>
^ #(ButtonAdapter
adapt: #(model))
OUTPUT
What is it composed from at run-time?
How was it build?
Spec / Adapter / Morphic composition
Spec Adapter
MorphicAdapter Morphic
ComposableModel AbstractAdapter
AbstractMorphicAdapter Morph
model widget
widgetmodel
Spec / Adapter / Morphic composition
ComposableModel
spec
SpecWrapper
selector
instance
AbstractAdapter
AbstractMorphicAdapter
MorphicContainerAdapterMorph
spec
/subwidgets
instance
model
model
widget
model
Digging through the Instances
We need to:
1. Represent the instances
2. Remember history / changes
UML INSTANCE METAMODEL
CUSTOM INSTANCE METAMODEL
InstanceSpecification
Domain Object representation
Classifier
Class of a Domain Object
Slot
Run-time attribute value
ImmutableObject
Frozen value not affected by further changes in
the Domain object
FROM INSTANCES TO INSTANCE
SPECIFICATIONS
CAPTURING INSTANCE INFORMATION
CAPTURING INSTANCE INFORMATION
What is the target object?
Class(ifier) specification
What information should be captured?
Declarative Slot description
How the information should be captured?
Behavior (MetaLink) insertions
BACK TO SPEC
ComposableModel
focusOrder
owner
window
extentHolder
needRebuild
additionalKeyBindings
announcer
keyStrokesForNextFocusHolder
keyStrokesForPreviousFocusHolder
windowIcon
aboutText
askOkToClose
titleHolder
specSelectors
whenBuiltDo:
ensureMorphicAdapter
removeMenuKeyCombination:
eventKeyStrokesForNextFocus
initialize
windowIcon:
updateTitle
newCheckBox
centerWidget:
newText
openDialogWithSpecLayout:
askOkToClose:
owner:
newButton
focusOrder:
newList
addAll:withSpec:
spec
aboutText:
heightToDisplayInTree:
heightToDisplayInList:
initialExtent
openDialogWithSpec
defaultSpecSelector
centered
openExternalWindowWithSpecLayout:
initializeDialogWindow:
resolveSymbol:
openExternalWindowWithSpec:
takeKeyboardFocus
spec:
privateAdapterFromModel:withSpec:
gtInspectorModelNestingIn:
okToChange
buildWithSpec:
windowIcon
initializePresenter
extent
openWithSpec:
defaultWindowModelClass
show
ensureExtentFor:
handlesKeyboard:
isDisplayed
focusOrder
setExtentAndBindingTo:
newTabManager
defaultSpec
bindKeyCombination:toAction:
announce:
bindMenuKeyCombination:toAction:
registerKeyStrokesForNextFor:
ensureMorphicAdapterDo:
keyStrokesForPreviousFocus:
announcer
private_buildWithSpec:
widthToDisplayInList:
newDropList
initializeWidgets
icon:
on:do:
needRebuild
cancelled
newTextInput
delete
private_buildWithSpec
centeredRelativeTo:
openWithSpecLayout:
newTree
window
openExternalWindowWithSpec
owner
aboutText
buildWithSpec
newSlider
hasWindow
on:send:to:
removeKeyCombination:
widthToDisplayInTree:
instantiate:
ensureKeyBindingsFor:
listRenderOn:atRow:bounds:color:backgroundColor:from:
askOkToClose
newCode
keyStrokeForPreviousFocus:
addMenuItemsToWindowMenu:
newRadioButton
openWorldWithSpec
newLabel
buildWithSpecLayout:
openWithSpec
title:
newImage
treeRenderOn:bounds:color:font:from:
newTab
extent:
keyStrokesForNextFocus:
openWorldWithSpec:
eventKeyStrokesForPreviousFocus
gtInspectorPreviewIn:
beginsWith:fromList:
addAll:withSpecLayout:
instantiateModels:
giveFocusToNextFrom:
applyMenuModel:
takeLastKeyboardFocus
needRebuild:
keyStrokeForNextFocus:
detectMorphicAdapterDo:ifNone:
retrieveSpec:
additionalKeyBindings
whenShortcutsChanged:
openWorldWithSpecLayout:
detectMorphicAdapterDo:
whenWindowChanged:
openDialogWithSpec:
newDiff
neglectMenuModel:
apiSelectors
registerKeyStrokesForPreviousFor:
update:
giveFocusToPreviousFrom:
adapterFrom:model:
hide
widget
newIconList
setModal:
newMultiColumnList
title
createInstanceFor:
defaultSpec
owner:
buttonWidth
buttonHeight
toolbarHeight
title
inputTextHeight
specSelectors
SpecWrapper
instance:
isRedrawable
removeSubWidgets
selector
instance
selector:
instance:selector:
AbstractMorphicAdapter
acceptDroppingMorph:event:inMorph:
enable
removeMenuKeyCombination:
delete
help
color
borderColor:
dragEnabled
color:
hSpaceFill
transferBlock
disable
removeKeyCombination:
widthToDisplayInTree:
dragPassengersFor:inMorph:
layout:
heightToDisplayInTree:
heightToDisplayInList:
wantDropBlock
listRenderOn:atRow:bounds:color:backgroundColor:from:
borderColor
dropEnabled
vShrinkWrap
treeRenderOn:bounds:color:font:from:
hRigid
isMorphicAdapter
beginsWith:fromList:
gtInspectorPreviewIn:
vRigid
hShrinkWrap
dragEnabled:
dropEnabled:
enabled
extent
wantsDroppedMorph:event:inMorph:
dragPassengerFor:inMorph:
acceptDropBlock
when:do:
setBalloonText:
bindKeyCombination:toAction:
dragTransformationBlock
enabled:
bindMenuKeyCombination:toAction:
useProportionalLayout
removeSubWidgets
transferFor:from:
vSpaceFill
borderWidth
setModal:
changed
borderWidth:
widthToDisplayInList:
defaultSpec
MorphicContainerAdapter
centerWidget:
checkSplitters
isRedrawable
newHSplitterAt:
buildWidget
newVSplitterAt:
ComposableModel
SpecWrapper
AbstractMorphicAdapter MorphicContainerAdapter
ComposableModel
spec
SpecWrapper
instance
selector
AbstractMorphicAdapter
CAPTURING INSTANCE INFORMATION
What is the target object?
Class(ifier) specification
What information should be captured?
Declarative Slot description
How the information should be captured?
Behavior (MetaLink) insertions
CLASSIFIER & SLOTS
wrapperSpec := LIVInstanceSpecificationBuilder new
wrapperSpec
classifier: SpecWrapper;
name: #identityHash;
addSlot: #selector -> nil;
addSlot: #instance -> nil.
adapterSpec := LIVInstanceSpecificationBuilder new.
adapterSpec
classifier: MorphicContainerAdapter;
name: #identityHash;
addSlot: #added -> [ OrderedCollection new ].
METALINKS (SIDETRACK)
METALINKS (SIDETRACK)
Ad-hoc behavior insertions to code
Person>>name: aString
name := aString
link := MetaLink new
metaObject: [ :object :newValue |
Transcript logCr: newValue
];
control: #after.
(Person>>name) ast assignmentNodes first link: link
Person>>name: aString
name := aString
"link metaObject value: self value: aString"
Objectifying behavior insertions into MetaLinks allows
us to treat it differently
METALINK INSERTIONS
(link := MTMetaLinkUser new)
target: SpecWrapper>>#instance:;
action: [ :object |
history inNewState: [ :model |
model
setLinkFrom: object to: object instance at: #instance
]
].
(link := MTMetaLinkUser new)
target: (AbstractMorphicAdapter>>#add:) ast assignmentNodes first
action: [ :object :newValue |
history inNewState: [ :model |
model addLinkFrom: object to: newValue at: #added
]
].
User is guiding the instance model construction
Wordy descriptions :(
Automatable :) (MetaLinks Toolkit)
Flexible – we can derive extra information
DEMO
FUTURE
MODELING
Adherence to a UML reference model
Automatic construction of a reference model
PRACTICAL
Automation (MetaLinks Toolkit)
Streamlining usage
Deeper integration with Debugger
AD-HOC RUNTIME OBJECT STRUCTURE
VISUALIZATIONS WITH METALINKS
INSTANCE VISUALIZATIONS
Peter Uhnak     Robert Pergl
Department of So ware Engineering
Faculty of Information Technology
Czech Technical University in Prague
Czech Republic
{uhnakpet|perglr}@fit.cvut.cz

Ad-hoc Runtime Object Structure Visualizations with MetaLinks