View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Brian's Coweb Assignment 2

A large part of Squeak is exploring code, and making sense of examples. For me, I found myself often asking the question "How is this method used?" when looking at an opaque piece of code.

There are two quick options in this case. You can test the method to see what it does, or you can look for more examples. This is where Squeak comes in handy. Select the method, rightclick for a menu, and select 'Senders of'
Uploaded Image: sendermenu.JPG
(You can also highlight a portion of text and use alt-n)
This will bring up a list of all methods, anywhere in the squeak image, that send this method. You can scroll through the list of them until you find a more clear example of this method's use.
Uploaded Image: senderresult.JPG

By the same token, 'Implementers of' finds all objects which receive a message. The menu (or alt-m) will bring this up. I found myself using this to quickly guess what objects were associated with pointers when exploring code.


These two ideas aren't specific Squeak, but MethodFinder is. Senders Of and Implements Of are good tools to quickly identify how a specific method is used. But you have to know the method name first. This is where MethodFinder comes in. You can open a MethodFinder by rightclicking on the world.

In the upper left window you can write the start of a method-name, and have it find all matches. But MethodFinder's coolest feature is the ability to give it an example object / return-value, have MethodFinder brute force every method in Squeak, and return possible matches.

For instance: You want an integer from a string, but don't know how. You type: '7'. 7
MethodFinder returns every method on '7' (a string) which spits out 7 (an int). You find one of these is 'asNumber'. Pretty promising, right?

Or: You want to reverse a string, but String has lots of methods. You type: 'Bingo'. 'ogniB'
MethodFinder shows that only one single method-call on 'Bingo' will return 'ogniB'. That method is called reversed. And you're done.
Uploaded Image: methodfinder.JPG

Link to this Page