ad-hoc runtime object structure visualizations with metalinks

31
AD-HOC RUNTIME OBJECT STRUCTURE VISUALIZATIONS WITH METALINKS Peter Uhnak Robert Pergl Department of Soware Engineering Faculty of Information Technology Czech Technical University in Prague Czech Republic {uhnakpet|perglr}@fit.cvut.cz

Upload: esug

Post on 28-Jan-2018

259 views

Category:

Software


4 download

TRANSCRIPT

AD-HOC RUNTIME OBJECTSTRUCTURE VISUALIZATIONS

WITH METALINKSPeter 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 VISUALIZATIONSPeter 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)

INPUTui := 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 compositionSpec Adapter

MorphicAdapter Morphic

ComposableModel AbstractAdapter

AbstractMorphicAdapter Morph

model widget

widgetmodel

Spec / Adapter / Morphic composition

ComposableModel

spec

SpecWrapper

selectorinstance

AbstractAdapter

AbstractMorphicAdapter

MorphicContainerAdapterMorph

spec

/subwidgets

instance

model

model

widget

model

Digging through the Instances

We need to: 1. Represent the instances2. Remember history / changes

UML INSTANCE METAMODEL

CUSTOM INSTANCE METAMODEL

InstanceSpecificationDomain Object representation

ClassifierClass of a Domain Object

SlotRun-time attribute value

ImmutableObjectFrozen value not affected by further changes inthe Domain object

FROM INSTANCES TO INSTANCESPECIFICATIONS

CAPTURING INSTANCE INFORMATION

CAPTURING INSTANCE INFORMATIONWhat is the target object?

Class(ifier) specificationWhat information should be captured?

Declarative Slot descriptionHow the information should be captured?

Behavior (MetaLink) insertions

BACK TO SPEC

ComposableModel

focusOrderownerwindow

extentHolderneedRebuildadditionalKeyBindingsannouncerkeyStrokesForNextFocusHolderkeyStrokesForPreviousFocusHolderwindowIconaboutTextaskOkToClosetitleHolder

specSelectorswhenBuiltDo:ensureMorphicAdapterremoveMenuKeyCombination:eventKeyStrokesForNextFocusinitializewindowIcon:updateTitlenewCheckBoxcenterWidget:newTextopenDialogWithSpecLayout:askOkToClose:owner:newButtonfocusOrder:newListaddAll:withSpec:specaboutText:heightToDisplayInTree:heightToDisplayInList:initialExtentopenDialogWithSpecdefaultSpecSelectorcenteredopenExternalWindowWithSpecLayout:initializeDialogWindow:resolveSymbol:openExternalWindowWithSpec:takeKeyboardFocusspec:privateAdapterFromModel:withSpec:gtInspectorModelNestingIn:okToChangebuildWithSpec:windowIconinitializePresenterextentopenWithSpec:defaultWindowModelClassshowensureExtentFor:handlesKeyboard:isDisplayedfocusOrdersetExtentAndBindingTo:newTabManagerdefaultSpecbindKeyCombination:toAction:announce:bindMenuKeyCombination:toAction:registerKeyStrokesForNextFor:ensureMorphicAdapterDo:keyStrokesForPreviousFocus:announcerprivate_buildWithSpec:widthToDisplayInList:newDropListinitializeWidgetsicon:on:do:needRebuildcancellednewTextInputdeleteprivate_buildWithSpeccenteredRelativeTo:openWithSpecLayout:newTreewindowopenExternalWindowWithSpecowneraboutTextbuildWithSpecnewSliderhasWindowon:send:to:removeKeyCombination:widthToDisplayInTree:instantiate:ensureKeyBindingsFor:listRenderOn:atRow:bounds:color:backgroundColor:from:askOkToClosenewCodekeyStrokeForPreviousFocus:addMenuItemsToWindowMenu:newRadioButtonopenWorldWithSpecnewLabelbuildWithSpecLayout:openWithSpectitle:newImagetreeRenderOn:bounds:color:font:from:newTabextent:keyStrokesForNextFocus:openWorldWithSpec:eventKeyStrokesForPreviousFocusgtInspectorPreviewIn:beginsWith:fromList:addAll:withSpecLayout:instantiateModels:giveFocusToNextFrom:applyMenuModel:takeLastKeyboardFocusneedRebuild:keyStrokeForNextFocus:detectMorphicAdapterDo:ifNone:retrieveSpec:additionalKeyBindingswhenShortcutsChanged:openWorldWithSpecLayout:detectMorphicAdapterDo:whenWindowChanged:openDialogWithSpec:newDiffneglectMenuModel:apiSelectorsregisterKeyStrokesForPreviousFor:update:giveFocusToPreviousFrom:adapterFrom:model:hidewidgetnewIconListsetModal:newMultiColumnListtitlecreateInstanceFor:

defaultSpecowner:buttonWidthbuttonHeighttoolbarHeighttitleinputTextHeightspecSelectors

SpecWrapper

instance:isRedrawableremoveSubWidgetsselectorinstanceselector:

instance:selector:

AbstractMorphicAdapter

acceptDroppingMorph:event:inMorph:enableremoveMenuKeyCombination:deletehelpcolorborderColor:dragEnabledcolor:hSpaceFilltransferBlockdisableremoveKeyCombination:widthToDisplayInTree:dragPassengersFor:inMorph:layout:heightToDisplayInTree:heightToDisplayInList:wantDropBlocklistRenderOn:atRow:bounds:color:backgroundColor:from:borderColordropEnabledvShrinkWraptreeRenderOn:bounds:color:font:from:hRigidisMorphicAdapterbeginsWith:fromList:gtInspectorPreviewIn:vRigidhShrinkWrapdragEnabled:dropEnabled:enabledextentwantsDroppedMorph:event:inMorph:dragPassengerFor:inMorph:acceptDropBlockwhen:do:setBalloonText:bindKeyCombination:toAction:dragTransformationBlock

enabled:bindMenuKeyCombination:toAction:useProportionalLayoutremoveSubWidgetstransferFor:from:vSpaceFillborderWidthsetModal:changedborderWidth:widthToDisplayInList:

defaultSpec

MorphicContainerAdapter

centerWidget:checkSplittersisRedrawablenewHSplitterAt:buildWidgetnewVSplitterAt:

ComposableModel SpecWrapper AbstractMorphicAdapter MorphicContainerAdapter

ComposableModel

spec

SpecWrapper

instanceselector

AbstractMorphicAdapter

CAPTURING INSTANCE INFORMATIONWhat is the target object?

Class(ifier) specificationWhat information should be captured?

Declarative Slot descriptionHow the information should be captured?

Behavior (MetaLink) insertions

CLASSIFIER & SLOTSwrapperSpec := 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 codePerson>>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 allowsus 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

FUTUREMODELING

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 STRUCTUREVISUALIZATIONS WITH METALINKS

INSTANCE VISUALIZATIONSPeter Uhnak     Robert Pergl

Department of So�ware Engineering Faculty of Information Technology

Czech Technical University in Prague Czech Republic

{uhnakpet|perglr}@fit.cvut.cz