As you explore a live model, you may find yourself repeatedly navigating through multiple inspector views to reach the information you want. How can you make this process more efficient?
Navigating to the data you want to reach may entail a sequence of operations, either clicking in views, or evaluating Playground snippets, to reach a new Inspector instance.
The sequence of steps may be cumbersome to follow repeatedly.
Turn interesting data into a
. Extract the navigation steps into a new custom view for the moldable object you start navigating from. Possibly start with a simple
forward view to an existing view of the target data, and later refine this into a dedicated view.
A simple example is the view of the state of the stack of the StackMachine.
In this example, we must navigate to the
stack slot to see the stack items.
By creating a forwarding view, we “lift” the view we want to the StackMachine itself:
Pretty much any view can be seen as an example of this principle. Consider the example of Working with a REST API: the GitHub case study. In the example below, the Repositories view is obtained by navigating to a list of repositories that are created programmatically.
By lifting this code into the
GhEntity subclass: #GhOrganization
class and creating a dedicated view, we can explore the repositories without having to first navigate to a collection of repositories.
Similarly, in the
GtLudoGame subclass: #GtLudoRecordingGame
, many of the views are lifted from collaborating objects to eliminate the need for navigation when exploring. The views for
all replace the need for navigation.
Sometimes repeated navigation code does not lead to a view but rather an action that is performed. In this case, instead of adding a custom view, a Custom action may be needed.