Squeak
  links to this page:    
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
DanielVainsenchersMysteries
Last updated at 4:12 pm UTC on 14 January 2006
Here are a few exercises to help you 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.

Exercises
  1. How many words are there in aString?
  2. How many different words are there in aString?
  3. 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.)
  4. 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.)
  5. What exactly is Display?
  6. What exactly is Pen?
  7. What are the concrete collection classes (a concrete class, not being abstract, can and usually will, have instances...)? describe each briefly.
  8. What are Dictionaries?
  9. What is a SystemDictionary? what is it's name? what does it include?
  10. Why is the method gcd: important? what is the best way of finding out the answer to this question?
  11. 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.
  12. 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.)
  13. 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 -
  14. What's rather unusual about ProcessorScheduler and SystemDictionary?
  15. What priority levels are there?
  16. 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.
  17. Rather advanced exercise - make a method that prints out the names of the temporary vars;in the method that called it.

Finished? Go to ... DanielVainsenchersMysteries