links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Squeak Programming:
Last updated at 2:20 pm UTC on 16 January 2006
Squeak Programming: Re-using Objects

Q: My first question is: Are there any Objects that I could re-use to create a user-interface for Trailblazer and/or Student Health Database? What are they?

R: Well, the obvious answer is yes - you will be using all sorts of morphs, collections, blocks, etc. In terms of the highest level of the interface, check out the BobsUIv2 and spreadsheet1 projects on BSS for some ideas (see also BobsUI). Additionally, as needs become clear, you will often see something in the image that's similar that you can borrow from. As an example, you might look at EToyProjectDetailsMorph and EToyProjectQueryMorph. To see an example of the first, hold down the Publish button on the navigator until the menu appears and select 'edit project info'. For the second, hold down the Find button and select 'search the SuperSwiki'.

I understand now that my challenge is to learn what classes are available and what they do, and then select the appropriate superclass! :)

Squeak Programming: Working with an ever-changing system: Object (code) durability.

Q: Is programming for Squeak like trying to hit a moving target? I have been following the Mailing list posts and one of the threads that caught my eye was "WindowFrame design"http://people.we.mediaone.net/trade/WindowFrames.htm. The work talked about in this thread is exciting, but it makes me wonder, would the objects being discussed be added to Squeak, or would they replace other objects? If they replace other objects, software for Squeak would have to constantly be updated because the old objects are no longer there (e.g., the BankAccount tutorial has had to undergo some changes because of changes in Squeak Classes). If, on the other hand, new objects are added to the system, does this not affect execution performance/speed of applications? On a similar topic, what are the criteria for deciding whether changes made constitute a version name change? More importantly, how often are version changes allowed (again with the moving target idea).
A: There are several possible answers to this question. First, no, it is not a moving target. If you download a Squeak image, it is under your complete control. You can keep running the same image for the next decade if you like. You'll miss interesting new developments, but you will have a stable base for your development. You can always selectively include interesting updates, sometimes easily and sometimes not. Second, yes, it is a moving target. Squeak is an ongoing exploration of new ideas in making computers more useful. Some experiments are dropped when they don't work out (although you can always find the dropped code in an older image and reinstall it if it's something you really like). Having given these two very clear answers, the truth is that an effort is made to minimize breakage caused by updates, both in terms of what's in the image and in terms of what has been published in Squeak projects. The steps involved in maintaining this backward compatibility will aid your in keeping you private code updated as well.

Squeak Programming: Object/Class/Method documentation
Q: What are the expectations as regards documentation, when people add system level objects/classes to Squeak? When I look at a Class, for example, AlignmentMorph, there is some double quote explanations provided, but not nearly enough to let me know what is going on, or how I should use that class.
A: Depends on who is doing the expecting. Some folks value separate documentation highly and others do not. Personally, I much prefer using the tools in Squeak to see how something is being used rather than reading how someone thought it would be used at some time in the past. Documentation rarely keeps pace with code, so I tend to trust the code. If you want to know how to use a class, searching for references to the class (control-n in the class list pane of a browser) will usually pull up all sorts of interesting examples. Using an explorer on an interesting morph will yield tons of information about how it is put together.

Squeak Programming: Numbers
Q: What does the :e and the | do in the above example?
A: In a block (something within square brackets), the :e means the first argument passed to the block will be known inside the block as 'e'. The vertical bar is simply a sign that the list of argument names is complete. In the specific example above, we don't really care what the argument is (it will be 1, then 2, then 3), but we need to tell the block to expect it anyway since #collect: expects a 1-argument block.

Squeak Programming: Syntax
Q: What is the difference between the semi-colon and the period? When I tried using the code below with a period, I received a "Nothing more expected" message.
StringHolder new
contents:#('alpha' 'beta' 'gamma' 'delta') atRandom;
openLabel: 'Your Window'
A: A period separates statements. A semi-colon separates messages that will be sent to the same receiver. Thus
a b ; c; d.
will send #b to a, then send #c to a and finally send #d to a.
On the other hand,
a b . c . d.
will send #b to a. (period, end of statement). After that, "c" is a separate statement (if it makes any sense). And then "d" is another statement.