In this videos, I'll show you the inspector
and how to use it.
What is the Inspector?
It's a tool that enables to interact with
any object of the system.
As in Pharo everything is written based on objects,
you can inspect all the objects composing Pharo.
The closest metaphor about what is the inspector:
the inspector is a microscope, but a microscope which
has capabilities to interact with the objects
it is observing. It is as if you were
a biologist studying cells or bacterias,
and all of a sudden you are able to, thanks to
a needle, interact with these living bacterias.
I have prepared a little expression.
In real life it would be very rare to put
a date, a time and a "Morph" mixed in a dictionary.
but for the purpose of this exercise it's ok.
Let's see this. The first thing to do once
you typed the expression, is to call upon
the inspector. So, we get the inspector.
You'll see it is a polymorphic object.
What does the inspector shows?
Here, it shows that I have several elements in my
collection. Each time I click on one element,
I will get another inspector opening
on the selected element.
You have to notice that the GT inspector
is the new version of the inspector in Pharo,
it is developed by the GT Team at Bern University.
What does it offer?
It offers the possibility to define different views
adapted to each particular object.
You may not inspect a dictionary
the same way you manipulate a graphical element.
The interesting point is that each one of these elements
can offer a different view to the user.
The basic view that you have is the Raw view.
This is the view showing the implementation.
For instance, I open the class
corresponding to OrderedDictionary, this class has
2 instance variables, dictionary and orderedKeys.
Here, the inspector will show me raw values
contained in these instance variables.
If I click on dictionary, I see it is a dictionary.
If I had clicked on it, I see here, it is a dictionary.
And there, I see once more the raw view of this object.
It has orderedKeys which is apparently an array.
I have an array with Time, Date and Morph.
When I am in Items mode - the Items mode is
that this OrderedDictionary element offers me to see
its keys and values in a better way.
If you look here, you have to go inside and
it gets a little touchy.
Here we don't know... "Which one is it?
Ah,it is this one, may be at 6 it means that
I have an association in which there is Time, I have the key and the value, etc."
So, you see that the inspector browses.
There is this little browsing bar.
When I put the cursor on these little circles, I see
a preview of the screen I will go to if I click on it.
I can also reduce or change
the windows' size and the focus I want.
I can select the three for instance. Here I choose a large size
for you to see better.
When I am in Items mode,
it is better because I can interact.
Here I see a date, the key and the value. For instance,
when I select, I see date, date in the raw format
of instance variables.
If I do self browse, you can imagine what we'll see.
We'll see exactly a date, Timespan,
so I have start and duration.
I do have start and duration.
If I look at the Details tab,
the date offers me to see it with,
for instance, a year, a month, that kind of things,
in an ISO format for instance.
How does it work?
We will see it in another video, but in fact each object
can decide the aspects it will show
and offer to the inspector.
Here there is the calendar for instance.
You can see there is a graphical representation of what is a date.
I go backward.
In the same way, for Times, you can see that there are the same things.
I have shown you the Raw tabs.
There is also the Meta tab.
It is a mini code browser which shows you the methods.
For instance, here I can see the methods
because I may wish to interact with the date, time.
Let's imagine that I don't know what I can send to it,
maybe I can send it hours.
It returns 18. It's 18.
Normally, I could see it there if I look for hour.
I got the method definition.
It is just to be more in the flow.
Now, if I look at Morph.
It is a more complicated object.
We see several different aspects.
What is nice here, for instance, is that if I click on
Morph, I see its rendering.
I see the rendering of the Morph object
which is indeed a HSVAColorSelectorMorph.
Just to show you, in fact with the inspector,
I can interact with my object.
I can tell it to open in a world and I can
interact with my object.
It will depend on which functionalities
it offers. I can do
selectedColor. We will see if it works.
If I do self selectedColor.
It returns a color.
Here it is interesting because
with the inspector I can do a print,
and it returns a textual representation of the object.
I could do inspect on it
and it will open an inspector.
It is what I’m doing here.
Now if I want the result of this
expression to be injected in the inspector flow,
what can I do?
I just have to do “Do it and go”.
If I do “Do it and go”, I have added in the interaction flow
a new object and an inspector on a new object.
You understood. Here it is the colors with the colors encoding.
Nothing special.
We go backward.
What is interesting to see, it is that here, I have
a view of my object, for instance in sub-morphs.
If I want to have the same view and if I want to find the
sub-morphs composing my graphical object,
when I’m in Raw mode, I have to browse
inside the graphical components tree.
It can be really annoying.
I will show you a nice tip.
Let’s imagine I have my Morph tree.
I have two views which are exactly the same on the same object.
I can do “Submorph”.
I do Submorph in this one and there I have Morph.
Now I can select the elements in the tree.
I tell it: “I want you to display there
only this one”, or for instance, here I am really
on the sub-morph of the tree corresponding to my selection.
It is very powerful because often, if I had to
find the sub-morph corresponding
to the little indicator, here it is quite easy, it is this one.
However, if I am in a traditional mode,
it is not so easy because…
in fact I don’t know how to do it.
I have to go inside
until I find it.
It is here I think, because here it is
a simple object.
You will see in the other videos that we can do
this kind of operation in every object of the system.
I will show you in particular that we can do it
on files systems, on classes themselves.
As a conclusion, what we have seen
is that the inspector is an object that will enable you
to talk to, interact with and modify living objects,
your objects, and in another hand, each object will
show different aspects or different views of itself
in order to have a different
interaction according to your scenarios.
It constitutes a very, very powerful object.
In fact, GT Inspector is really a great tool.