. .

st4u

ST 4U 72: Exploring VA Smalltalk

April 20, 2011 11:17:32.460

Today's Smalltalk 4 You looks at one way of exploring VA Smalltalk. One of the things I like to do with a system I'm not terribly familiar with is start from something I do know, and explore from there. In this screencast, we take a bit of code I know well, and use it to jump into the tools and system. If you prefer a written walkthrough to video, then skip down to it. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube. To watch now, click on the image below:

Exploring VA

If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.

You can also watch it on YouTube:


One of the best ways that I know of to explore a new Smalltalk system is to take a piece of code I've written quite a lot in other Smalltalks, and start exploring the system using that as a jumping off point. That way, I'm not stumbling over both the less familiar system and the code at the same time. Translating that to VA Smalltalk, I took this as my starting point:


count := 1.
block := [[true] whileTrue:
				[count := count + 1.
				Transcript show: count printString; cr.
				(Delay forSeconds: 2) wait]].
proc := block forkAt: Processor userBackgroundPriority.


It's the core of just about every server process I've ever created in Smalltalk - except that the real ones do actual work instead of writing to the Transcript. For our purposes here though, this is perfect. Let's start by highlighting Processor in the workspace, right clicking, and selecting inspect. This is what you should see:

ProcessorScheduler

From there, it might be interesting to look at the implementation. So back in the launcher, select Tools>>browse class:

Browse Class

You should see the class browser, allowing you to start looking at the implementation:

Browsing Class

One thing that's different about VA, at least compared to Squeak, Pharo, or VisualWorks - look at the three tabs above the selector pane on the right - public, private, all. In VA, private methods are a bit more segregated. There's nothing in the system that prevents you from invoking a private method, but VA does make them visibly separate in a way that most Smalltalks don't. This makes it much more obvious when you are crossing the divide between a public API and a private one.

Now we might want to look at the actual Process class - we have one running, and it would be useful to be able to control it. Let's go back to the workspace, and inspect the proc variable:

Inspect a Process

Inspector on a Process

From here, you can browse the class directly. On the toolbar for the inspector, find the Browse Hierarchy button and click it:

Hierarchy Browser

Clicking around we spot the #terminate method, and we go back to the workspace, invoke that code and kill the running process:

Terminate a Process

In future tutorials, we'll start examining each of these tools - browsers and inspectors - in depth. Today's goal was to show you how you can use a small bit of pre-existing knowledge as a jumping off point to explore VA Smalltalk

Need more help? There's a screencast for this topic which you may want to watch. Questions? Try the "Chat with James" Google gadget over in the sidebar.

Technorati Tags: , ,

Enclosures:
[st4u72-iPhone.m4v ( Size: 9068300 )]

posted by James Robertson

 Share Tweet This