Re: Beginners Digest, Vol 93, Issue 1: object instance browser

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Beginners Digest, Vol 93, Issue 1: object instance browser

projectVALIS
Thank you everyone for your alacritous responses! 

I'm finding one of the challenges in learning Smalltalk is not the syntax of the code, nor the general paradigm by which the code is implemented, but understanding the tools well enough to make things happen. I'm an experienced programmer and I'm finding that I'm having to completely rethink the way I go about my work when diddling around with this language. That's not in and of itself a bad thing - just saying I'm thankful for this mailing list :-) 


David Holiday 
-------------------------------------------------
San Diego State University





On Jan 1, 2014, at 4:00 AM, [hidden email] wrote:

Send Beginners mailing list submissions to
[hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.squeakfoundation.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[hidden email]

You can reach the person managing the list at
[hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

  1. Re: object instance browser? (Herbert K?nig)
  2. Re: object instance browser? (Chris Muller)
  3. Re: object instance browser? (karl ramberg)


----------------------------------------------------------------------

Message: 1
Date: Tue, 31 Dec 2013 14:50:55 +0100
From: Herbert K?nig <[hidden email]>
Subject: Re: [Newbies] object instance browser?
To: [hidden email]
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Merci vielmals.

Am 31.12.2013 11:27, schrieb Bert Freudenberg:
Yes, multiple ones in fact. This is a major reason working in
Smalltalk feels more immediate than in other environments.
......
Great explanation scrubbed


------------------------------

Message: 2
Date: Tue, 31 Dec 2013 13:02:51 -0600
From: Chris Muller <[hidden email]>
Subject: Re: [Newbies] object instance browser?
To: "A friendly place to get answers to even the most basic questions
about Squeak." <[hidden email]>
Message-ID:
<CANzdToH+hPyJqeBqSdWLwROi5w_SbdAu_G9oWm3BgRkTqa=[hidden email]>
Content-Type: text/plain; charset=UTF-8

Great post, I learned some new things.

On Tue, Dec 31, 2013 at 4:27 AM, Bert Freudenberg <[hidden email]> wrote:
On 31.12.2013, at 08:53, David Holiday <[hidden email]> wrote:

Is there a way to browse the ecosystem of objects in a Smalltalk image?

Yes, multiple ones in fact. This is a major reason working in Smalltalk feels more immediate than in other environments.

I'm not talking about the class browser, what I'm looking for is a way to see what objects have actually been instantiated and what their state is.

The basic tool for this is called an Inspector. Whenever you have an expression, like "3 + 4", you press cmd-i to "inspect it", which opens an inspector on the result. This works in any text area. Try for example inspecting "self" in a class browser, and you will inspect the underlying class object (which the browser shows a high-level view of).

In the Inspector you see the objects referenced by this object (via instance variables or indexed fields) in the left panel. Select any of them and choose "inspect" from the context menu (or press cmd-i again). This way you can inspect all the objects in the system.

A more modern tool than the Inspector (which was around 40 years ago already) is the Object Explorer. It presents you a tree view of an object and its "children", which again are the instance variables and indexed fields of the object. Open it with cmd-shift-i (or "explore" in the context menu).

You can also do the reverse. If you choose "objects pointing to this value" you get an inspector showing all the objects that directly point to this object. Similarly there is a "reverse explorer", which you can open by selecting "explore pointers".

There are two roots to all the objects in the system:

       Smalltalk specialObjectsArray

which basically holds everything the Virtual Machine needs to know about, and in turn almost every object in the whole image, and

       thisContext

which is the current execution context, holding onto temporary objects. When a garbage collection is performed, any object not reachable form either of these two roots is removed from memory.

An "interesting" global object to explore is

       Project current

which holds your current workspace, in particular

       Project current world

, the root of all morphs in the world. And of course

       Smalltalk

itself is the dictionary that holds all global objects, including all classes (unless they are defined in a non-global environment).

There is also a low-level way to enumerate all objects in memory. "self someObject" will return the very first object in memory (which happens to be the nil object), and "anObject nextObject" will return the next one:

       | object count |
       count := 0.
       object := self someObject.
       [0 == object]
               whileFalse: [count := count + 1.
                       object := object nextObject].
       count

Interestingly, this also finds objects that are due to be garbage-collected. For example, if you accidentally closed a text window, there is a good chance its contents will still be in memory, and can be retrieved using an expression like

       ByteString allInstances last: 10

This makes use of the someInstance/nextInstance methods, which are similar to someObject/nextObject, but restricted to instances of one class only.

Hope you have fun poking around in the world of objects :)

- Bert -


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


------------------------------

Message: 3
Date: Wed, 1 Jan 2014 02:23:04 +0100
From: karl ramberg <[hidden email]>
Subject: Re: [Newbies] object instance browser?
To: "A friendly place to get answers to even the most basic questions
about Squeak." <[hidden email]>
Cc: David Holiday <[hidden email]>
Message-ID:
<[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

I do it :-)

Happy new year!

Cheers,
Karl


On Tue, Dec 31, 2013 at 12:40 PM, Bert Freudenberg <[hidden email]>wrote:

Hey, I wrote it, you make the workspace, deal? ;)

Happy New Year, btw.

- Bert -

On 31.12.2013, at 12:37, karl ramberg <[hidden email]> wrote:

Make a Welcome Workspace with this info :-)

Cheers,
Karl


On Tue, Dec 31, 2013 at 11:27 AM, Bert Freudenberg <[hidden email]>wrote:

On 31.12.2013, at 08:53, David Holiday <[hidden email]> wrote:

Is there a way to browse the ecosystem of objects in a Smalltalk image?

Yes, multiple ones in fact. This is a major reason working in Smalltalk
feels more immediate than in other environments.

I'm not talking about the class browser, what I'm looking for is a way
to see what objects have actually been instantiated and what their state is.

The basic tool for this is called an Inspector. Whenever you have an
expression, like "3 + 4", you press cmd-i to "inspect it", which opens an
inspector on the result. This works in any text area. Try for example
inspecting "self" in a class browser, and you will inspect the underlying
class object (which the browser shows a high-level view of).

In the Inspector you see the objects referenced by this object (via
instance variables or indexed fields) in the left panel. Select any of them
and choose "inspect" from the context menu (or press cmd-i again). This way
you can inspect all the objects in the system.

A more modern tool than the Inspector (which was around 40 years ago
already) is the Object Explorer. It presents you a tree view of an object
and its "children", which again are the instance variables and indexed
fields of the object. Open it with cmd-shift-i (or "explore" in the context
menu).

You can also do the reverse. If you choose "objects pointing to this
value" you get an inspector showing all the objects that directly point to
this object. Similarly there is a "reverse explorer", which you can open by
selecting "explore pointers".

There are two roots to all the objects in the system:

       Smalltalk specialObjectsArray

which basically holds everything the Virtual Machine needs to know about,
and in turn almost every object in the whole image, and

       thisContext

which is the current execution context, holding onto temporary objects.
When a garbage collection is performed, any object not reachable form
either of these two roots is removed from memory.

An "interesting" global object to explore is

       Project current

which holds your current workspace, in particular

       Project current world

, the root of all morphs in the world. And of course

       Smalltalk

itself is the dictionary that holds all global objects, including all
classes (unless they are defined in a non-global environment).

There is also a low-level way to enumerate all objects in memory. "self
someObject" will return the very first object in memory (which happens to
be the nil object), and "anObject nextObject" will return the next one:

       | object count |
       count := 0.
       object := self someObject.
       [0 == object]
               whileFalse: [count := count + 1.
                       object := object nextObject].
       count

Interestingly, this also finds objects that are due to be
garbage-collected. For example, if you accidentally closed a text window,
there is a good chance its contents will still be in memory, and can be
retrieved using an expression like

       ByteString allInstances last: 10

This makes use of the someInstance/nextInstance methods, which are
similar to someObject/nextObject, but restricted to instances of one class
only.

Hope you have fun poking around in the world of objects :)

- Bert -


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners




_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20140101/f713a71f/attachment-0001.htm

------------------------------

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 93, Issue 1
****************************************


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Beginners Digest, Vol 93, Issue 1: object instance browser

David T. Lewis
On Thu, Jan 02, 2014 at 05:04:50PM -0800, David Holiday wrote:
> Thank you everyone for your alacritous responses!
>
> I'm finding one of the challenges in learning Smalltalk is not the syntax of the code, nor the general paradigm by which the code is implemented, but understanding the tools well enough to make things happen. I'm an experienced programmer and I'm finding that I'm having to completely rethink the way I go about my work when diddling around with this language. That's not in and of itself a bad thing - just saying I'm thankful for this mailing list :-)
>

It does take a bit of getting used to, especially if you are an old
goat like me. But it is worth the effort.

Youthful and inexperienced people say that there is really not much
effort involved in learning this stuff, but I'm not personally in a
position to confirm or deny that claim.

Dave

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: [SPAM] Re: [Newbies] Re: Beginners Digest, Vol 93, Issue 1: object instance browser

Mateusz Grotek
What I personally missed the most in comparison with other languages is
the methods documentation. Not that we don't have tools for that (IMHO
method comments are enough if they are specific enough), but there is
not enough of them inside the image. What I miss is for example some
information concerning the classes of the arguments of functions (or
rather example classes to be exact :-P).
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Beginners Digest, Vol 93, Issue 1: object instance browser

Bert Freudenberg
In reply to this post by David T. Lewis
On 03.01.2014, at 02:36, David T. Lewis <[hidden email]> wrote:

> On Thu, Jan 02, 2014 at 05:04:50PM -0800, David Holiday wrote:
>> Thank you everyone for your alacritous responses!
>>
>> I'm finding one of the challenges in learning Smalltalk is not the syntax of the code, nor the general paradigm by which the code is implemented, but understanding the tools well enough to make things happen. I'm an experienced programmer and I'm finding that I'm having to completely rethink the way I go about my work when diddling around with this language. That's not in and of itself a bad thing - just saying I'm thankful for this mailing list :-)
>>
>
> It does take a bit of getting used to, especially if you are an old
> goat like me. But it is worth the effort.
>
> Youthful and inexperienced people say that there is really not much
> effort involved in learning this stuff, but I'm not personally in a
> position to confirm or deny that claim.

Hah! You should hear students complain ;)

- Bert -


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Beginners Digest, Vol 93, Issue 1: object instance browser

kilon.alios
In reply to this post by projectVALIS
Personally I am finding Smalltalk a breath of fresh air. I cant say I was challenged to learn Squeak tools  even though Squeak was the first Smalltalk I tried and few years ago, even though I have been coding for fun for 26 years ,  I had no idea Smalltalk existed.

I find coding too stuck to stone age, still CL coding being the most popular way to code and tools, IDE tools still to primitive for coding and languages barely change and move forward.  But the "stone age" curse is dominant in area of life that money and big businesses takes a hold of. Smalltalk for me is like the "bronze age" . So as you imagine I laugh every time I hear about "modern language" or "modern tools" for coding.  For me we still have a long way to go before we reach a "modern" state but Smalltalk is definitely pointing to a good direction.

Learning is a lengthy process. If you can jump to using something easily , then it means you don't have something new to learn and that is definitely a bad thing. Knowledge is everything.