Skip to main content

Learning by tearing things apart

Daniel Klein posted to the Squeak Beginners list:

I'm currently reading the 'Squeak by Example' book with the goal of being able to do some Morphic stuff.

Anyway, I get the impression that everything in the image at my fingertips. So what if I want to add something to one of the context menus, or find out what message gets sent to invoke a menu entry so that I can run it directly in a workspace, or change the order of the objects in one of the flaps, etc.

What are the steps to go about finding out where this stuff is in the image?

One of the neat things about Morphic is that you can tear it apart while it is running. This can give you some clues as to how a GUI was built. Note that the image is built by direct manipulation as well as by code. If you move a window and then save the image, the window will be where you left it. But, you won't be able to find the code that moved the window to that location because there isn't any.

But, most GUIs in Squeak are built with Smalltalk code, not with direct manipulation.

One of my favorite things to show a new Squeaker is that they can Alt+Shift click on the World menu to bring up a halo on a menu item (Alt+Clicking will let you drill into a GUI, Alt goes backward which usually gets to the menu or icon directly and bypasses all of the alignment morphs.)

I then click on the debug halo and look at an explorer.

This tells me that the Menu Item calls #doMenuItem:with: and passes two arguments. TheWorldMenu and another selector helpDo.

I can then start browsing implementors and senders. I think helpDo is the more interesting implementation and leads me quickly to helpMenu.

doMenuItem:with: is the more interesting sender. It takes me to fillIn:from: and then senders there takes me to I think what you are looking for (I see my CSS is cropping the pic, click to see the whole thing).


Popular posts from this blog

Installing Dart and CoffeeScript

Giving a talk on Monday, June 18 on  CoffeeScript and Dart  that will mostly be a code-along. For CoffeeScript, make sure you can run coffee from a command line: node, download here: npm, now included in node CoffeeScript, use the CoffeeScript with Node and npm instructions (basically one line, but...) Some kind of programmer's text editor. I'll be using jEdit, but I'd recommend VIM or TextMate as they both have great CoffeeScript integration. For Dart, install the Dart editor, which is an IDE with a browser (Dartium). Dart editor, download here: Unpack the archive someplace and run the program from there.

Apple Hater Converted? I want an iPad!

I've tweeted several times about my misgivings on the Apple iPad. Still not getting an iPad (I'm a h8r), but Gruber's got a point against my main beef (the closed platform) Apr 02 2010 No scripting/coding on the iPhone was pad enough. But the iPad could have been great 4 kids to learn 2 code. Too bad. Jan 31st if I had an iPad rather than a real computer as a kid, I’d never be a programmer today -- Alex Payne Jan 29th I'd prefer an open platform. I think the changes to section 3.2.2 of the developer agreement are a small step in the right direction, and  I'd like to see more openness. From Boy Genius : Apple has again tweaked section 3.2.2 of the agreement, adding in a loophole which will allow them to approve certain interpretive code tools. The old section 3.2.2 read like this:  No interpreted code may be downloaded or used in an Application except for code that is interpreted a

Pride and Shame: A simple code review format for developing developers

Gave this talk at BarCamp Omaha this September. Thanks to TechOmaha for recording!