=== Top of the Swiki === Attachments ===
Here are a few exercises that help one to get familiar with various important classes and tools in squeak.
If you can think of good additional exercises, that help to get to know Smalltalk & Squeak specifically, I'd like to hear about 'em.
I suggest writing your answers down, and then showing them to someone more experienced. You might learn as much by asking them how they find the answers as by having them tell you what they think is right.
Remember- don't guess the answers, it's much better to go forth and explore until you feel that you grok the subject.
The exercises assume 3 things - you know the basic syntax of Smalltalk, you have a working Squeak, and you know how to use the
basic Squeak UI. If any of those 3 are a problem, ask me, I'll be glad to help.
- How many words are there in aString?
- How many different words are there in aString?
- How many appearances are there of each kind of word in aString? (a good solution for the previous question has precisely one more message send than a good solution to this one.)
- Draw a circle made of 50 points on the middle of the screen (Display will come in handy. look at the examples in the class Pen.)
- What exactly is Display?
- What exactly is Pen?
- What are the concrete collection classes (a concrete class, not being abstract, can and usually will, have instances...)? describe each briefly.
- What are Dictionaries?
- What is a SystemDictionary? what is it's name? what does it include?
- Why is the method gcd: important? what is the best way of finding out the answer to this question?
- Look at some source. Right click on it. choose more until you see explain, format, and such. Explain what they and the other menu choices do. Some of them offer you a menu of possibilities. Play with them, explain what they do in general. Use them to revise your answer to the previous question.
- What are the control structures in Squeak? (hint: what is similar about #ifTrue:ifFalse:, #whileTrue:, #do:, #inject:into:..... ? what is it that allows them to be control structures? look for that in other messages.)
- Look at Delay>>testDelayOf:for:rect:. Run the examples embedded in the method. Look at the code. Look at the classes in it's category. Answer the following questions -
- What's rather unusual about ProcessorScheduler and SystemDictionary?
- What priority levels are there?
- Draw the the 50 points, and make them take 200 seconds to get drawn, without stopping the user from using the system. Check how much time this really took (exactly, meaning a stopwatch isn't good enough). Make it take more than 200 seconds, by being a nuisence as a user. If you wish, make it take 200 seconds (almost) no matter what.
- Rather advanced exercise - make a method that prints out the names of the temporary vars *in the method that called it*.