toc.prn - Squeak
Transcript of toc.prn - Squeak
![Page 1: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/1.jpg)
The joy of SmalltalkAn introduction to Smalltalk
© Ivan Tomek, 2000
![Page 2: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/2.jpg)
![Page 3: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/3.jpg)
![Page 4: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/4.jpg)
Introduction to Smalltalk, VisualWorks - Table of contents Ivan Tomek 9/18/00
3
5.4 Using numbers for iteration - ‘repeat n times’5.5 Repeating a block for all numbers between a start and a stop value5.5 Repeating a block with a specified step5.7 Measuring the speed of arithmetic and other operations5.8 Declaring a new class: Currency
![Page 5: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/5.jpg)
![Page 6: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/6.jpg)
Introduction to Smalltalk, VisualWorks - Table of contents Ivan Tomek 9/18/00
5
![Page 7: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/7.jpg)
![Page 8: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/8.jpg)
![Page 9: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/9.jpg)
![Page 10: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/10.jpg)
![Page 11: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/11.jpg)
![Page 12: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/12.jpg)
![Page 13: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/13.jpg)
![Page 14: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/14.jpg)
Introduction to Smalltalk - Chapter 1 - Object-oriented programming - essential concepts Ivan Tomek 9/17/00
4
285 + (37 squared)
Smalltalk now asks 37 to execute message squared. This returns object 1369 and the code noweffectively becomes
285 + 1369
Smalltalk now asks object 285 to execute message + with argument 1369. This returns the finalresult 1654. Note that this works because all Smalltalk messages return objects, and messages can thus becombined.
The examples that you have just seen cover all possible forms of Smalltalk messages and if theygive you the impression that Smalltalk is essentially simple, you are quite right - Smalltalk is based on veryfew very powerful ideas. Unfortunately, the ease of reading and writing pieces of Smalltalk programs doesnot mean that writing significant Smalltalk programs such as a word processors or spreadsheets is very easy.Difficult task are difficult even in Smalltalk - but not as difficult as in most other languages as you will seelater.
At this point, you would probably like to proceed to other Smalltalk programs, and if you really
![Page 15: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/15.jpg)
![Page 16: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/16.jpg)
![Page 17: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/17.jpg)
![Page 18: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/18.jpg)
Introduction to Smalltalk - Chapter 1 - Object-oriented programming - essential concepts Ivan Tomek 9/17/00
8
1. I press the Power button, which can be interpreted as sending message ‘Initiate cooking time setting
![Page 19: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/19.jpg)
![Page 20: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/20.jpg)
Introduction to Smalltalk - Chapter 1 - Object-oriented programming - essential concepts Ivan Tomek 9/17/00
10
Figure 1.7. The opening window of Farm Launcher. Use it to select the first version of the Farm program.Farm
![Page 21: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/21.jpg)
![Page 22: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/22.jpg)
![Page 23: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/23.jpg)
![Page 24: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/24.jpg)
![Page 25: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/25.jpg)
Introduction to Smalltalk - Chapter 1 - Object-oriented programming - essential concepts Ivan Tomek 9/17/00
15
3 + 5
must be treated as a message + to object 3 to do addition with object 5 as in
‘Object 3, do
![Page 26: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/26.jpg)
Introduction to Smalltalk - Chapter 1 - Object-oriented programming - essential concepts Ivan Tomek 9/17/00
16
and executes it with the do it command. This sends the open message to Farm and Smalltalk starts bylooking for the definition of the
![Page 27: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/27.jpg)
![Page 28: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/28.jpg)
![Page 29: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/29.jpg)
![Page 30: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/30.jpg)
![Page 31: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/31.jpg)
![Page 32: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/32.jpg)
![Page 33: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/33.jpg)
![Page 34: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/34.jpg)
![Page 35: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/35.jpg)
Introduction to Smalltalk - Chapter 1 - Object-oriented programming - essential concepts
![Page 36: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/36.jpg)
![Page 37: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/37.jpg)
Introduction to Smalltalk - Chapter 1 - Object-oriented programming - essential concepts Ivan Tomek 9/17/00
27
![Page 38: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/38.jpg)
![Page 39: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/39.jpg)
![Page 40: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/40.jpg)
Introduction to Smalltalk - Chapter 1 - Object-oriented programming - essential concepts Ivan Tomek 9/17/00
30
Figure 1.30. A very small part of VisualWorks class hierarchy tree. Concrete classes are shown in boldface,all other classes are abstract.
To find out about Smalltalk’s class hierarchy, use the System Browser. After selecting a class suchas Magnitude, select the hierarchy command in the class view <operate> menu and the text view willdisplay as in Figure 1.31, showing subclasses and superclasses and all instance variables.
Figure 1.31. System Browser showing a part of the hierarchy of class Magnitude.
The hierarchy shown in Figure 1.31 shows both abstract and concrete classes. Class Magnitude isabstract and factors out properties needed for comparison, and its subclasses include numbers, printablecharacters, date objects, and time objects. Magnitude has no instances because there is no need for such
![Page 41: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/41.jpg)
![Page 42: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/42.jpg)
![Page 43: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/43.jpg)
Introduction to Smalltalk - Chapter 1 - Object-oriented programming - essential concepts Ivan Tomek 9/17/00
33
Exercises
1. Find and count all definitions (‘implementations’) of the following methods.a. displayOn:b. squaredc. <d. =
2. Give an example of polymorphism from the physical world.3. The three animals in the Farm world share the following messages: color, name, eat, isHungry, run,
walk. Some of them are implemented in the same way in each animal, others are not and the programexecutes them polymorphically. List each group on the basis of your intuition.
Conclusion
![Page 44: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/44.jpg)
![Page 45: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/45.jpg)
![Page 46: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/46.jpg)
![Page 47: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/47.jpg)
Introduction to Smalltalk - Chapter 1 - Object-oriented programming - essential concepts Ivan Tomek 9/17/00
![Page 48: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/48.jpg)
![Page 49: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/49.jpg)
![Page 50: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/50.jpg)
![Page 51: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/51.jpg)
![Page 52: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/52.jpg)
Introduction to Smalltalk - Chapter 2 - Finding objects Ivan Tomek 9/17/00
42
2. Repeat Exercise 1 but assign each classes instead of pieces. Each card contains the name of the class,its brief description, and a list of its functionalities. Replay the scenarios.
3.
![Page 53: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/53.jpg)
![Page 54: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/54.jpg)
Introduction to Smalltalk - Chapter 2 - Finding objects Ivan Tomek 9/17/00
44
section. We then expand the high-level conversations from Step 1 into class-level conversationsinvolving the identified classes.As we develop the conversations, we record the responsibilities that the classes must have to implement
![Page 55: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/55.jpg)
![Page 56: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/56.jpg)
![Page 57: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/57.jpg)
![Page 58: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/58.jpg)
![Page 59: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/59.jpg)
![Page 60: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/60.jpg)
![Page 61: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/61.jpg)
Introduction to Smalltalk - Chapter 2 - Finding objects Ivan Tomek 9/17/00
51
We will now evaluate the desirability of the selected nouns as classes:
• Address. If the address included the name of the city, postal code, province or state, and otherinformation, we would implement it as a class. As it is, an address is just a string of alphabetic andnumeric characters and strings are already in the library. We thus remove
![Page 62: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/62.jpg)
Introduction to Smalltalk - Chapter 2 - Finding objects Ivan Tomek 9/17/00
52
1. Assign each class to an individual or a small group that will be responsible for maintaining allinformation about the class.
2. Each group prepares a CRC card (Figure 2.8) for its class. Use 5 x 8” paper index cards.3.
![Page 63: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/63.jpg)
![Page 64: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/64.jpg)
![Page 65: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/65.jpg)
![Page 66: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/66.jpg)
![Page 67: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/67.jpg)
![Page 68: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/68.jpg)
![Page 69: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/69.jpg)
![Page 70: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/70.jpg)
Introduction to Smalltalk - Chapter 2 - Finding objects Ivan Tomek 9/17/00
60
3. User clicks Open.4. System opens Farm 1 user interface.
Scenario 4: User sends ‘meow’ to the cat.High-level conversation:1. User clicks cat in the Animals list.2. System displays commands understood by cat and updates the rightmost part of the window.3. User clicks meow.4.
![Page 71: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/71.jpg)
![Page 72: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/72.jpg)
Introduction to Smalltalk - Chapter 2 - Finding objects Ivan Tomek 9/17/00
62
Identify class responsibilities
We will now examine our scenarios and expand high-level conversations into class-level conversations.
Scenario 1: User starts Farm.High-level conversation:1.
![Page 73: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/73.jpg)
![Page 74: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/74.jpg)
![Page 75: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/75.jpg)
Introduction to Smalltalk - Chapter 2 - Finding objects Ivan Tomek 9/17/00
65
Components:• list of commands understood• list of commands forbidden in Farm1Responsibilities •
![Page 76: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/76.jpg)
Introduction to Smalltalk - Chapter 2 - Finding objects Ivan Tomek 9/17/00
66
• Opening•
![Page 77: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/77.jpg)
![Page 78: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/78.jpg)
![Page 79: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/79.jpg)
Introduction to Smalltalk - Chapter 2 - Finding objects Ivan Tomek 9/17/00
69
Cow: Simulated cow. Knows the commands it understands and how to respond to them. Knows commandsthat it should not understand in Farm1. A domain object.Superclass: ObjectComponents
![Page 80: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/80.jpg)
![Page 81: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/81.jpg)
Introduction to Smalltalk - Chapter 2 - Finding objects Ivan Tomek 9/17/00
71
Exercises
1. Repeat the example, completing all CRC cards, writing all missing scenarios, descriptions, andperforming all required tests.
2.
![Page 82: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/82.jpg)
Introduction to Smalltalk - Chapter 2 - Finding objects Ivan Tomek 9/17/00
72
• Construct a Context Diagram showing external actors (outside the scope of current project) and majorparts of the system to be developed.
• Construct a Glossary of terms. This Glossary will be continuously updated during the process.
Preliminary Design:
![Page 83: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/83.jpg)
Introduction to Smalltalk - Chapter 2 - Finding objects
![Page 84: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/84.jpg)
![Page 85: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/85.jpg)
![Page 86: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/86.jpg)
![Page 87: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/87.jpg)
![Page 88: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/88.jpg)
![Page 89: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/89.jpg)
![Page 90: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/90.jpg)
![Page 91: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/91.jpg)
![Page 92: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/92.jpg)
Introduction to Smalltalk - Chapter 3 - Principles of Smalltalk Ivan Tomek 9/17/00
82
Dealing with simpler errors
Sooner or later, you will type and attempt to execute incorrect code. Code can be incorrect in morethan one way:
•
![Page 93: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/93.jpg)
![Page 94: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/94.jpg)
![Page 95: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/95.jpg)
![Page 96: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/96.jpg)
![Page 97: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/97.jpg)
![Page 98: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/98.jpg)
![Page 99: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/99.jpg)
Introduction to Smalltalk - Chapter 3 - Principles of Smalltalk Ivan Tomek 9/17/00
89
'a cat' spellAgainst: 'a car' “Returns 80 - degree of similarity between the two strings.”
Whereas one-keyword messages don’t seem to cause any problems, keyword messages with multiplekeywords may be more difficult to read. Beginners often don’t understand that the multiple keywords form
![Page 100: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/100.jpg)
![Page 101: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/101.jpg)
![Page 102: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/102.jpg)
![Page 103: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/103.jpg)
![Page 104: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/104.jpg)
![Page 105: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/105.jpg)
![Page 106: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/106.jpg)
![Page 107: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/107.jpg)
![Page 108: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/108.jpg)
Introduction to Smalltalk - Chapter 3 - Principles of Smalltalk Ivan Tomek 9/17/00
98
Figure 3.13. Debugger window with two most recently invoked methods shown on top.
To see the code of a message and the point reached in its execution, click the appropriate line inthe call stack. Since a code fragment is always referred to as
![Page 109: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/109.jpg)
![Page 110: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/110.jpg)
![Page 111: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/111.jpg)
![Page 112: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/112.jpg)
![Page 113: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/113.jpg)
![Page 114: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/114.jpg)
![Page 115: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/115.jpg)
![Page 116: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/116.jpg)
![Page 117: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/117.jpg)
![Page 118: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/118.jpg)
![Page 119: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/119.jpg)
![Page 120: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/120.jpg)
![Page 121: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/121.jpg)
![Page 122: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/122.jpg)
![Page 123: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/123.jpg)
![Page 124: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/124.jpg)
![Page 125: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/125.jpg)
![Page 126: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/126.jpg)
![Page 127: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/127.jpg)
![Page 128: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/128.jpg)
![Page 129: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/129.jpg)
![Page 130: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/130.jpg)
![Page 131: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/131.jpg)
![Page 132: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/132.jpg)
![Page 133: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/133.jpg)
![Page 134: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/134.jpg)
![Page 135: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/135.jpg)
![Page 136: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/136.jpg)
Introduction to Smalltalk - Chapter 4 - True and False objects, blocks, selection and iteration Ivan Tomek 9/17/00
126
class. To do this, open a Browser, and add a new category called for example Tests using the add …T e s t N a m e 2 2 . 0 8 4 n a m e 1 2 / F 0 9 . 9 6 T f - 0 . 0 3 4 3 T c
![Page 137: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/137.jpg)
Introduction to Smalltalk - Chapter 4 - True and False objects, blocks, selection and iteration Ivan Tomek 9/17/00
127
This class has not yet been commented. The comment should state the purpose of the class, whatmessages are subclassResponsibility, and the type and purpose of each instance and class variable. Thecomment should also explain any unobvious aspects of the implementation.
Select the whole text and replace it with a comment. There are two styles for writing the comment.One is very antropomorphic and uses the first person as in ‘I represent a name ..’. Its advantage is that itmakes you think in terms of the class which always helps. The other style is less personal and uses the thirdperson as in ‘This class represents a name …’. This style seems less extravagant. Choose the style that youlike better and use it consistently. We will use the first style because it will force us to think as if we werethe class which seems a good idea at this point of the book. Following the template, we write
I represent a personal name consisting of a first name, a middle name, and a last name.
Instance variables
firstName <String> first namemiddleName <String> middle namelastName <String> last name
The comment seems almost unnecessary because it seems very obvious but it is an essentialpractice to use class comments. As an example, the indication that the values of variables should be String
![Page 138: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/138.jpg)
Introduction to Smalltalk - Chapter 4 - True and False objects, blocks, selection and iteration Ivan Tomek 9/17/00
128
Figure 4.12. Browser with method template.
Let’s start with the get method for the firstName instance variable. A get message simply returnsthe value of a variable and it is standard practice that it is named with the name of the instance variable. Thedefinition is thus
firstName^ firstName
![Page 139: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/139.jpg)
Introduction to Smalltalk - Chapter 4 - True and False objects, blocks, selection and iteration Ivan Tomek 9/17/00
129
should return ‘John’. Type this expression into a workspace and execute with print it to see that it indeeddoes.
Now that we think about it, it seems that our approach could cause a problem. A programmermight, for example, create a Name object and give it a first and last name but no middle name. If a programthen tried to print the name, it would fail on the middle name because its value would be nil and nil does notunderstand String messages. It will thus be a good idea to modify the instance creation message so that itinitializes all instance variable to empty strings with no characters in them. This is, of course, rather uselessbut at least it will not cause a crash if a variable is left unassigned.
There are several possible solutions to our problem and the simplest one is to define a newinitialization method that forces the user to enter some strings for each of the instance variables as in
Name first: ‘John’ middle: ‘Mathew’ last: ‘Smith’
This new message is obviously a class message because the receiver is the class which creates theobject. We will thus define it on the class side and put it into a new protocol called instance creation . Its
![Page 140: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/140.jpg)
![Page 141: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/141.jpg)
![Page 142: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/142.jpg)
![Page 143: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/143.jpg)
![Page 144: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/144.jpg)
Introduction to Smalltalk - Chapter 4 - True and False objects, blocks, selection and iteration Ivan Tomek 9/17/00
134
[self <= max]
to the true object. This returns true or false. The Boolean result is then returned. Note that all subclasses ofMagnitude including Date,
![Page 145: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/145.jpg)
![Page 146: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/146.jpg)
![Page 147: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/147.jpg)
![Page 148: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/148.jpg)
![Page 149: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/149.jpg)
![Page 150: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/150.jpg)
Introduction to Smalltalk - Chapter 4 - True and False objects, blocks, selection and iteration Ivan Tomek 9/17/00
140
Figure 4.19. y := x := ‘John Smith’ binds x and y to the same object and both x=y and x==y are true.
As another example, consider that class True and False each have only one instance. As aconsequence, equivalence and equality of Boolean objects mean the same thing.
The check of equivalence is faster because it only compares the memory addresses of the internal
![Page 151: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/151.jpg)
![Page 152: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/152.jpg)
![Page 153: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/153.jpg)
![Page 154: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/154.jpg)
![Page 155: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/155.jpg)
![Page 156: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/156.jpg)
![Page 157: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/157.jpg)
![Page 158: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/158.jpg)
![Page 159: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/159.jpg)
![Page 160: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/160.jpg)
![Page 161: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/161.jpg)
![Page 162: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/162.jpg)
Introduction to Smalltalk - Chapter 4 - True and False objects, blocks, selection and iteration Ivan Tomek 9/17/00
152
singleton - the single instance of a class that does not allow multiple instancestruth table - a table defining a Boolean operation by listing all combinations of true and false operand
![Page 163: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/163.jpg)
Introduction to Smalltalk - Chapter 5 - Numbers Ivan Tomek 9/17/00
153
Chapter 5 - Numbers
Overview
VisualWorks library contains many classes representing numbers of various kinds, mainly becausecomputers internally represent and process different kinds of numbers differently. In addition, computerprograms often require facilities that go beyond basic hardware capabilities and Smalltalk number classessatisfy these additional needs.
![Page 164: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/164.jpg)
![Page 165: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/165.jpg)
![Page 166: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/166.jpg)
![Page 167: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/167.jpg)
![Page 168: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/168.jpg)
![Page 169: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/169.jpg)
![Page 170: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/170.jpg)
![Page 171: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/171.jpg)
![Page 172: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/172.jpg)
![Page 173: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/173.jpg)
![Page 174: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/174.jpg)
![Page 175: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/175.jpg)
![Page 176: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/176.jpg)
![Page 177: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/177.jpg)
![Page 178: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/178.jpg)
![Page 179: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/179.jpg)
![Page 180: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/180.jpg)
![Page 181: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/181.jpg)
![Page 182: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/182.jpg)
![Page 183: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/183.jpg)
![Page 184: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/184.jpg)
![Page 185: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/185.jpg)
![Page 186: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/186.jpg)
![Page 187: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/187.jpg)
![Page 188: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/188.jpg)
Introduction to Smalltalk - Chapter 5 - Numbers Ivan Tomek 9/17/00
178
Design
The behaviors that we expect of Currency include creation (create a new Currency object),arithmetic (add or subtract two Currency objects), comparison (equal, not equal, less than, and so on), andprinting (for testing and inspecting). Each of these behaviors will be implemented as a protocol, and thenotion of dollars and cents suggests the use of two instance variables called dollars and cents.
We have now decided all the major features of Currency except where to put it in the classhierarchy. Currency CMagnitde Tj -338948 011.76 TD -F0 9.96 Tf -0.0101 Tc 0.0176 Tw (nbrnce of thesclass) tree. Sice vcrrencyis calndol smplem rithmetic ,we emustcomnsdedrwherhesrthescsuperlass
C u r r e n c y Currency
![Page 189: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/189.jpg)
![Page 190: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/190.jpg)
![Page 191: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/191.jpg)
![Page 192: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/192.jpg)
![Page 193: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/193.jpg)
Introduction to Smalltalk - Chapter 5 - Numbers Ivan Tomek 9/17/00
183
Currency dollars: 100 cents: 3412
creates a Currency object with 100 dollars and 3412 cents but we would prefer a Currency object with 134dollars and 12 cents. Similarly,
Currency dollars: 100 cents: -34
![Page 194: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/194.jpg)
Introduction to Smalltalk - Chapter 5 - Numbers Ivan Tomek 9/17/00
184
cents:
![Page 195: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/195.jpg)
Introduction to Smalltalk - Chapter 5 - Numbers Ivan Tomek 9/17/00
185
4. Currency
![Page 196: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/196.jpg)
![Page 197: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/197.jpg)
Introduction to Smalltalk - Chapter 5 - Numbers Ivan Tomek 9/17/00
187
origin printOn: aStream.aStream nextPutAll: ' corner: '.corner printOn: aStream
and extend it as follows:
printOn: aStream"Append to the argument aStream a sequence of characters that identifies the receiver. The general formatis originPoint corner: cornerPoint angle: angle."
super printOn: aStream.aStream nextPutAll: ' angle: '.angle printOn: aStream
In this definition, super is a special identifier that allows us to access an identically named method
![Page 198: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/198.jpg)
![Page 199: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/199.jpg)
![Page 200: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/200.jpg)
![Page 201: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/201.jpg)
![Page 202: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/202.jpg)
![Page 203: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/203.jpg)
![Page 204: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/204.jpg)
![Page 205: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/205.jpg)
![Page 206: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/206.jpg)
![Page 207: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/207.jpg)
![Page 208: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/208.jpg)
![Page 209: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/209.jpg)
![Page 210: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/210.jpg)
Introduction to Smalltalk - Chapter 6 - Design of applications with graphical user interfaces
![Page 211: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/211.jpg)
![Page 212: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/212.jpg)
![Page 213: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/213.jpg)
![Page 214: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/214.jpg)
![Page 215: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/215.jpg)
![Page 216: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/216.jpg)
![Page 217: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/217.jpg)
![Page 218: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/218.jpg)
![Page 219: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/219.jpg)
![Page 220: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/220.jpg)
![Page 221: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/221.jpg)
![Page 222: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/222.jpg)
![Page 223: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/223.jpg)
![Page 224: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/224.jpg)
![Page 225: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/225.jpg)
![Page 226: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/226.jpg)
![Page 227: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/227.jpg)
![Page 228: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/228.jpg)
![Page 229: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/229.jpg)
![Page 230: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/230.jpg)
![Page 231: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/231.jpg)
![Page 232: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/232.jpg)
![Page 233: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/233.jpg)
![Page 234: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/234.jpg)
![Page 235: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/235.jpg)
![Page 236: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/236.jpg)
![Page 237: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/237.jpg)
![Page 238: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/238.jpg)
![Page 239: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/239.jpg)
![Page 240: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/240.jpg)
![Page 241: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/241.jpg)
![Page 242: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/242.jpg)
![Page 243: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/243.jpg)
![Page 244: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/244.jpg)
![Page 245: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/245.jpg)
![Page 246: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/246.jpg)
![Page 247: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/247.jpg)
![Page 248: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/248.jpg)
![Page 249: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/249.jpg)
![Page 250: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/250.jpg)
Introduction to Smalltalk - Chapter 7 - Introduction to Collections Ivan Tomek 9/17/00
240
#(1 2 3 4 5 3 4 5 3 4 5) do: [:el| Trancript cr; show: el printString] exceptFor: 3
We found that all tests worked but we should, of course, test the method for other kinds of
![Page 251: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/251.jpg)
Introduction to Smalltalk - Chapter 7 - Introduction to Collections Ivan Tomek 9/17/00
241
1. Test conversion messages asSet, asSortedCollection, asr Tf rderllection
![Page 252: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/252.jpg)
![Page 253: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/253.jpg)
![Page 254: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/254.jpg)
![Page 255: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/255.jpg)
![Page 256: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/256.jpg)
![Page 257: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/257.jpg)
![Page 258: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/258.jpg)
![Page 259: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/259.jpg)
![Page 260: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/260.jpg)
![Page 261: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/261.jpg)
![Page 262: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/262.jpg)
Introduction to Smalltalk - Chapter 7 - Introduction to Collections Ivan Tomek 9/17/00
252
TwoDList columns: 3 rows: 5
returns TwoDList (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil).
Accessing a TwoDList
Just like Array, TwoDList is accessed by at: and at:put:. The difference is that the at: argument isnormally a Point because a position in a table requires two coordinates. The x part of the point is the columnnumber, and the y part is the row number. The following example illustrates the principle:
| table |table := TwoDList on: #(12 14 16 21 42 24) columns: 3 rows: 2.Transcript clear; cr; show: (table at: 1@2) printString. "Prints 21 – element in column 1, row 2."table at: 2@2 put: 77.able at16 232TD 0.036 T4c 0.872"talnglust Tw uctt: 7774
![Page 263: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/263.jpg)
![Page 264: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/264.jpg)
![Page 265: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/265.jpg)
![Page 266: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/266.jpg)
![Page 267: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/267.jpg)
![Page 268: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/268.jpg)
![Page 269: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/269.jpg)
![Page 270: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/270.jpg)
![Page 271: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/271.jpg)
![Page 272: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/272.jpg)
![Page 273: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/273.jpg)
![Page 274: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/274.jpg)
![Page 275: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/275.jpg)
![Page 276: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/276.jpg)
![Page 277: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/277.jpg)
![Page 278: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/278.jpg)
![Page 279: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/279.jpg)
Introduction to Smalltalk - Chapter 8 - More Sequenceable Collections, List widgets Ivan Tomek 9/17/00
270
never redefine it in any subclass. Method basicAt: has exactly this role. If everybody plays by the rules,basicAt: thus has a guaranteed single definition that we can always rely on. When you examine the library,you will find that there are quite a few
![Page 280: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/280.jpg)
![Page 281: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/281.jpg)
![Page 282: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/282.jpg)
![Page 283: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/283.jpg)
Introduction to Smalltalk - Chapter 8 - More Sequenceable Collections, List widgets Ivan Tomek 9/17/00
274
(items inject: (Currency cents: 0)into: [:total :item | total + item price]) displayString
Note the use of inject:into: with Currency objects, and the displayString message - you may haveexpected printString. displayString
![Page 284: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/284.jpg)
![Page 285: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/285.jpg)
![Page 286: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/286.jpg)
![Page 287: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/287.jpg)
![Page 288: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/288.jpg)
![Page 289: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/289.jpg)
![Page 290: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/290.jpg)
![Page 291: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/291.jpg)
![Page 292: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/292.jpg)
![Page 293: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/293.jpg)
![Page 294: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/294.jpg)
![Page 295: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/295.jpg)
![Page 296: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/296.jpg)
![Page 297: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/297.jpg)
![Page 298: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/298.jpg)
![Page 299: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/299.jpg)
Introduction to Smalltalk - Chapter 8 - More Sequenceable Collections, List widgets Ivan Tomek 9/17/00
290
“Initialize items to a suitably sized sorted collection. Sort alphabetically by name.”items := SortedCollection sortBlock: [:item1 :item2| (item1 name) < (item2 name)].self execute
Exercises
1. Find and examine all references to sortBlock: and determine which of them are instance messages: andwhy they are used.
2. Study and describe how SortedCollection adds a new element.3. Browse SortedCollectionWithPolicy and explain how it differs from SortedCollection.4. Formulate the sort block for storing entries of the library catalog from the Section 8.3 in a
SortedCollection using the alphabetical order of author names. Make up any necessary accessingmethods.
5. Write a code fragment to create ten random rectangles and sort them in the order of increasing area.6. ( I t e m s e q u e e S l a g e t M a k , o r t t i f S l a g e t M a k f r e q u e r t b l M a k e r t n e e S f i r g e t M a k . E x n d o d e r t b p r e v i o u s t e ) S t u 5 4 1 T 1 5 ( ) T j t h e a l p h a b e T j a s e r t b p r i m t a l o g o m p a r i s f S l 7 3 t b l M a k e r t n e e S f i r g e t M a r t b l M 3 t b c i r c u m / F 3 9 f S l 7 3 t b s e c o n d n e e S f i r g e t M a r 6 .
![Page 300: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/300.jpg)
![Page 301: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/301.jpg)
![Page 302: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/302.jpg)
![Page 303: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/303.jpg)
![Page 304: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/304.jpg)
![Page 305: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/305.jpg)
![Page 306: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/306.jpg)
![Page 307: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/307.jpg)
![Page 308: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/308.jpg)
![Page 309: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/309.jpg)
![Page 310: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/310.jpg)
![Page 311: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/311.jpg)
Introduction to Smalltalk - Chapter 8 - More Sequenceable Collections, List widgets Ivan Tomek 9/17/00
302
contentsFromUser"Answer an Image with the contents of a user-specified area on my screen."
^self completeContentsOfArea: Rectangle fromUser
This shows that if we have a window rectangle (call it windowRectangle) we can obtain its rectangle by
Screen default completeContentsOfArea: windowRectangle
![Page 312: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/312.jpg)
![Page 313: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/313.jpg)
![Page 314: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/314.jpg)
![Page 315: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/315.jpg)
![Page 316: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/316.jpg)
![Page 317: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/317.jpg)
![Page 318: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/318.jpg)
![Page 319: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/319.jpg)
![Page 320: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/320.jpg)
![Page 321: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/321.jpg)
![Page 322: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/322.jpg)
![Page 323: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/323.jpg)
![Page 324: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/324.jpg)
![Page 325: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/325.jpg)
![Page 326: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/326.jpg)
![Page 327: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/327.jpg)
![Page 328: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/328.jpg)
![Page 329: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/329.jpg)
![Page 330: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/330.jpg)
![Page 331: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/331.jpg)
![Page 332: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/332.jpg)
![Page 333: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/333.jpg)
![Page 334: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/334.jpg)
![Page 335: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/335.jpg)
![Page 336: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/336.jpg)
Introduction to Smalltalk - Chapter 9 - Sets, bags, and dictionaries Ivan Tomek 9/17/00
327
the second association replaces the first one because its key is equal to the first key.IdentityDictionary is an important subclass of Dictionary that uses equivalence instead of equality,
and is internally represented as a collection of keys and a collection of values rather than as a set ofassociations. An IdentityDictionary is often used as a kind of a knapsack to carry around a variety ofidentifiable objects that could not be predicted when a class was designed and consequently could not bedeclared as instance variables. To put this differently, an IdentityDictionary
![Page 337: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/337.jpg)
![Page 338: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/338.jpg)
![Page 339: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/339.jpg)
![Page 340: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/340.jpg)
![Page 341: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/341.jpg)
![Page 342: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/342.jpg)
![Page 343: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/343.jpg)
![Page 344: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/344.jpg)
![Page 345: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/345.jpg)
Introduction to Smalltalk - Chapter 9 - Sets, bags, and dictionaries Ivan Tomek 9/17/00
336
Deletion will be implemented by instance method language1Delete: aString (and a symmetric methodlanguage2Delete: aString). The method deletes the whole language1 association with key aString, andpropagates the change to language2. Since this and similar messages are sent by the pop up menu after theuser has made a selection in the user interface, we can assume that aString is present in the set of keys oflanguage1. We can thus use removeKey: and similar messages without worrying about the ifAbsent: part.The algorithm for responding to pop up command delete when a word in language 1 is selected is asfollows:
1.
![Page 346: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/346.jpg)
![Page 347: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/347.jpg)
![Page 348: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/348.jpg)
![Page 349: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/349.jpg)
![Page 350: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/350.jpg)
Introduction to Smalltalk - Chapter 9 - Sets, bags, and dictionaries Ivan Tomek 9/17/00
341
Figure 9.13. State transition table of a JK flip-flop.
![Page 351: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/351.jpg)
![Page 352: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/352.jpg)
![Page 353: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/353.jpg)
![Page 354: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/354.jpg)
![Page 355: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/355.jpg)
![Page 356: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/356.jpg)
Introduction to Smalltalk - Chapter 10 - Streams, files, and BOSS Ivan Tomek 9/17/00
348
There are methods that only work with external streams, methods that can be used with read streams but notwith write streams, and so on. Most of these limitations are obvious and natural.
Creation
Internal streams are usually created with class methods on: with:
![Page 357: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/357.jpg)
![Page 358: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/358.jpg)
Introduction to Smalltalk - Chapter 10 - Streams, files, and BOSS Ivan Tomek 9/17/00
350
upTo: anObject - repeats sending next until it reaches the first occurrence of anObject or the readLimit. Itreturns a collection whose elements2 are the elements retrieved by the consecutive next messagesfrom the start of the iteration up to but not including anObject. The pointer is left pointing atanObject so that the next next
![Page 359: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/359.jpg)
![Page 360: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/360.jpg)
![Page 361: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/361.jpg)
![Page 362: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/362.jpg)
![Page 363: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/363.jpg)
![Page 364: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/364.jpg)
![Page 365: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/365.jpg)
![Page 366: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/366.jpg)
Introduction to Smalltalk - Chapter 10 - Streams, files, and BOSS Ivan Tomek 9/17/00
358
2. Repeat for each position of the input stream beginning from the start:a. For each element of the dictionary do:
i. Increment current position holder for match string.ii. Compare input string and match character.
1. If no match, reset current position holder for match string to 0.2. If match, check if this is the last character to match.
![Page 367: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/367.jpg)
![Page 368: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/368.jpg)
Introduction to Smalltalk - Chapter 10 - Streams, files, and BOSS Ivan Tomek 9/17/00
360
1. Extend TextFilter to accept blocks as replacement arguments as stated in the specification.
10.5 Example: Circular Buffer
In computing terminology, a buffer is a memory area that accepts data from one process and emitsit to another process; the two processes work at their own speeds. An example of the use of a buffer isreading a block of data from a file into memory where it is processed one byte at a time by a program.Another example is a computing node on a network that accepts parcels of data arriving in unpredictableamounts and at unpredictable times, processes them one byte at-a-time, and possibly sends the data on toanother network node.
The hardware implementation of buffers often has the form of a special memory chip with a fixednumber of memory locations with pointers to the first byte to be retrieved, and to the location where thenext byte is to be stored as in Figure 10.8. When a new byte arrives, it is stored at the next availablelocation and the pointer is incremented, and when a byte is required from storage, it is removed from thelocation pointed to and the pointer incremented.
Figure 10.8. Buffer as a fixed size array with pointers to the next available byte and the next availablelocation.
In reality, of course, a byte read from the buffer is not ‘removed’ and only the changed value of thepointer indicates that the byte has been used. Similarly, an ‘empty’ position is not really empty but the new
lomuctr Buarh pmeonc the fomenadic of medingsn of bue pointion isbthe chze ar bue poffer i Tj 36 -11.76 TD -00056 Tc 0.4192.6Tw (The haffer isdoenot rof course, a haveo) Tj T*0Tc 0.0366Tw ( ) Tj 10.646 -3 TD -0.0161 Tw 0.4199 Tw (In stspecial merdware imip wia )an Fifactit isusuly em not r.Tj -208.06 -35.76 TD -0.0122 Tc 1.6722 Tc (In rstd fit isc � stjust memory arrngi to)t themtr t them ccular Baffer isea t. lementatg terh procend anccular Baffer isstrtioe 10ithem purintar bue stoecon.
Ivalementat comcular Baffer isbad one fixed s-ze array w. ratenssef the
spoca, a haveo
the nqu st onenot rof courionandeeme161 wfacaeinef thelelt roaal merdware im,ugtwlsfunstomhalitbushhemess and
![Page 369: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/369.jpg)
![Page 370: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/370.jpg)
![Page 371: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/371.jpg)
![Page 372: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/372.jpg)
Introduction to Smalltalk - Chapter 10 - Streams, files, and BOSS Ivan Tomek 9/17/00
364
Figure 10.10. Main classes used in file processing.
The cookbook procedure for processing data stored in a file is as follows:
1.
![Page 373: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/373.jpg)
Introduction to Smalltalk - Chapter 10 - Streams, files, and BOSS Ivan Tomek 9/17/00
365
Class Filename is an abstract class and its concrete subclasses (MaxFilename, PCFilename and itssubclasses, and UnixFilename) implement the platform-specific behavior needed on your machine, such asparsing platform-specific syntax of file names. However, you never need to deal with these concretesubclasses because Filename automatically sends all platform-dependent messages to the subclassrepresenting your platform. This is done via Filename’s class variable DefaultClass which holds the nameof the appropriate Filename class. Removing explicit dependence on one platform makes it possible to writeprograms that will run on different platforms. This arrangement is similar to the implementation of strings.
External streams perform data transfer operations. Instances of external streams are never createdby class messages to external stream classes but by messages to the Filename
![Page 374: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/374.jpg)
![Page 375: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/375.jpg)
![Page 376: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/376.jpg)
![Page 377: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/377.jpg)
![Page 378: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/378.jpg)
![Page 379: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/379.jpg)
Introduction to Smalltalk - Chapter 10 - Streams, files, and BOSS Ivan Tomek 9/17/00
371
Example 3: Let user delete a file from a listProblem: Implement a method to display the file names in the current directory in a multiple choice dialog,and allow the user to delete a fileSolution: This problem does not require a specific Filename
![Page 380: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/380.jpg)
![Page 381: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/381.jpg)
Introduction to Smalltalk - Chapter 10 - Streams, files, and BOSS Ivan Tomek 9/17/00
373
This explains how the limited number of external stream classes (Figure 10.8) can provide such avariety of accessing modes - the type of access is controlled by an instance of FileConnection. The otherstream creation messages are similar.
Since a file and its mode of access are two separate things, a file initially accessed via one kind of
![Page 382: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/382.jpg)
![Page 383: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/383.jpg)
![Page 384: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/384.jpg)
![Page 385: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/385.jpg)
![Page 386: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/386.jpg)
![Page 387: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/387.jpg)
![Page 388: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/388.jpg)
Introduction to Smalltalk - Chapter 10 - Streams, files, and BOSS Ivan Tomek 9/17/00
380
The basic definition of storeOn: in Object simply generates messages to create a new instance ofthe receiver and further messages to initialize its variables. The interesting part of the definition is that it
![Page 389: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/389.jpg)
![Page 390: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/390.jpg)
![Page 391: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/391.jpg)
![Page 392: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/392.jpg)
Introduction to Smalltalk - Chapter 11 - Stacks, queues, linked lists, trees, and graphs Ivan Tomek 9/17/00
384
messagecontext
messagecontext
![Page 393: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/393.jpg)
![Page 394: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/394.jpg)
![Page 395: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/395.jpg)
![Page 396: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/396.jpg)
![Page 397: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/397.jpg)
![Page 398: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/398.jpg)
![Page 399: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/399.jpg)
![Page 400: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/400.jpg)
![Page 401: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/401.jpg)
![Page 402: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/402.jpg)
![Page 403: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/403.jpg)
![Page 404: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/404.jpg)
![Page 405: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/405.jpg)
![Page 406: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/406.jpg)
![Page 407: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/407.jpg)
Introduction to Smalltalk - Chapter 11 - Stacks, queues, linked lists, trees, and graphs Ivan Tomek
![Page 408: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/408.jpg)
Introduction to Smalltalk - Chapter 11 - Stacks, queues, linked lists, trees, and graphs Ivan Tomek 9/17/00
400
queue length. The output will, of course, be left to the application model (class BankSimulation) to display.This way, if we want to change the user interface (output of results) or make our simulation a part of alarger scheme, the domain objects can stay the same and only the application model must be changed.
![Page 409: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/409.jpg)
![Page 410: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/410.jpg)
![Page 411: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/411.jpg)
Introduction to Smalltalk - Chapter 11 - Stacks, queues, linked lists, trees, and graphs Ivan Tomek 9/17/00
403
• lowerLimit: anInteger upperLimit: anInteger.• Accessing - implemented by
• next. Returns random integer.
![Page 412: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/412.jpg)
![Page 413: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/413.jpg)
Introduction to Smalltalk - Chapter 11 - Stacks, queues, linked lists, trees, and graphs Ivan Tomek 9/17/00
405
4. No complete match, copy character from string to result, increment position in string and result.5. Compare position 2 in pair1 ($b) with first character of string - match.6. Compare position 1 in pair2 ($a) with first character of string key; no match.7. We have a complete match. Select the longest replacement possible, changing result to ‘xx’.8. Continue in this way until the last character in string. At this point, there are two matches and two
possible replacements. The longer one is selected giving result = ‘xxcdyy’ as expected.
This scenario works as expected. But wait - the behavior in the following scenario does not quitemeet our expectations.
Scenario 2: Filtering string = ‘abcd’ with match/replacement pairs pair1 = ‘bc’->‘xx’, pair2 = ‘abcd’->‘yy’Assume string = ‘abcd’ and match/replacement pairs pair1 = ‘bc’->‘xx’string = abcd’STw (key; no maTj 10.12 0 TD722F0 9.96aTf -0. Tfobtaed. Butmonue T Tfsed and match/Tj 69yyent pairs) �s selected giving string = Assume as expec 0.sfinishe2 0 TD36.3beD14-220..211F0 9.96 Tf 0.0256 Tc 0.0044 Tw ( to ) Tj 12.84 0 TDng = ‘ t o t B n c t o f - 2 u e u 0 n T j 1 T * d r T f w 4 0 T D n 4 2 7 T f - 0 . 0 W h e 0 6 i t D - 0 . , u s e 5 2 i t D s c t i n o n g - 2 1 d 1 1 8 T p r a t e l 9 T w ( ) T . a r i o 2 : u e T T f s e d a n d 2 1 8 8 0 3 T f l l 2 4 8 2 a i t e w B 0 2 T c e 6 2 m u l t e l 9 - 2 1 d l g i g i t h m c 0 T T f 2 5 1 . 9 6 D 0 . 0 4 2 q m 0 T T 5 3 s c ( S T w ( a n d 0 7 6 2 0 3 T f l l 3 5 6 2 0 3 n 9 r i g c a n r e f u l l y w e 6 8 5 u t k o n g e 9 l o o k 6 t T j - 2 o b j 0 . s / F 2 a c t o c 0 . 0 1 1 8 s e d i 0 t e e 2 T j k 4 s r T f 5 2 2 2 - > ª 3 1 1 - 1 1 . 7 s u b p p o d w i n t n g I n a d 9 i . 0 . 0 6 s c t 4 2 e a m e . 0 9 0 3 T c ( 2 8 T j - 2 i 6 s c t k e e p t D i k o f - 2 i g i t B w ( 4 2 T - > . 0 9 T w 2 1 ( 7 4 w e T j 1 1 D 0 t e e 2 T j k 4 r T f 8 7 0 T D n 4 2 1 T D 0 . 0 0 a l s o / F 2 a T j 1 1 D 0 2 4 2 0 o 3 e r - 1 a s e d i T c 1 9 8 4 2 1 6 0 T D 0 . 0 4 2 2 - 6 7 T j 1 1 c t e d > ‘ y s t r i n t o ) T j D / F 2 9 0 8 T f - 0 . 0 0 8 3 T . 2 1 4 1 . 4 3 3 3 T w ( C o n t i n u e i n 1 3 1 8 0 3 T f 4 n 6 4 7 T f - 0 . 0 A > u e u 0 w h o e 5 2 e 6 r o d s . 2 - 1 0 9 l l 0 . 0 . 0 w o f p l d w i a y 6 T D d , e t c o c i 0 2 9 5 - 1 1 8 5 u c a \ i . T j 1 1 D 0 t e e 2 T j k 4 s t r i n g = ) T j 1 3 - T i T D 0 . 0 4 2 M n g s e s I n 4 0 T . 1 7 4 T c ( W a i j T - 4 0 7 T - 4 6 . 4 3 3 3 T w ( C o n t i n u e i n 1 f 9 7 0 T D n m 3 T - T i n 9 r > . 0 9 i f w o u ) T . 0 i 5 2 0 0 c l e t c v a r a t b l 0 n T j 1 T - 9 n g s 0 T - 4 6 . 3 e r - 1 a s e d i T c 1 9 8 4 2 1 6 0 T D 0 . 0 4 2 2 - 6 7 T j 1 1 c t e d > ‘ y s t r i n t o ) T j D / F 2 9 0 8 T f - 0 . 0 0 8 3 T . 2 1 4 1 . 4 3 3 3 T w ( C o n t i n u e i n 1 0 8 o u l d w i n g 8 9 . 9 6 0 . 0 A > 0 9 l l 0 . 0 . 0 6 o f a u e t c o c i 0 2 9 5 ) T j w 2 - 1 f u l l y 6 T D d , e 0 9 � d y ’ ) 2 1 T w ( ) T . n g ) i s c 8 5 u b e 0 0 c l e t c T j 1 1 D 0 t e e 2 T j k 4 r T 1 2 f i n i s h e T 1 7 2 = � v a r a t b l 0 u c a e T c 0 6 1 . 0 8 - > ‘ y s t r i n g = ) T j 2 4 8 0 3 T f 0 = � R 2 2 d y A s e R 1 T w ( ) T . T j 1 1 � . 0 0 4 4 T w ( t o ) T j 1 2 2 2 2 - > ( n T j 1 T - 1 7 T - 0 8 - - 2 3 2 2 2 - s e d a n d 2 1 2 2 2 - > ¬ 9 f - 0 . 0 W . 0 9 o u l d w b D i k g r T j d w e c a n 0 0 f u l l y 6 d e s c r i b e g i v i n g s c t e 8 g c 2 e d u r e 0 ) T j - s : j 1 1 D 0 2 4 2 2 2 - s e d a 5 4 9 i n i s h e 2 0 T 2 1 T j 1 T - 7 e d > ‘ y s t r i n t o
![Page 414: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/414.jpg)
![Page 415: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/415.jpg)
![Page 416: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/416.jpg)
![Page 417: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/417.jpg)
![Page 418: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/418.jpg)
![Page 419: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/419.jpg)
Introduction to Smalltalk - Chapter 11 - Stacks, queues, linked lists, trees, and graphs Ivan Tomek 9/17/00
411
SortedLinkedList (LinkNode 3 LinkNode 13 LinkNode 33)SortedLinkedList (LinkNode 0 LinkNode 3 LinkNode 13 LinkNode 33)
Finally, we must test that SortedLinkedList works even with non-default sort blocks and we thusdefine a new SortedLinkedList creation method called sortBlock: and modify our test program to create anew list with the same elements sorted in descending order:
| sll |Transcript clear.sll := SortedLinkedList sortBlock: [:x :y | x > y].Transcript show: sll printString; cr.sll add: 3.Transcript show: sll printString; cr.sll add: 33.Transcript show: sll printString; cr.sll add: 13.Transcript show: sll printString; cr.sll add: 0.Transcript show: sll printString
The test produces
SortedLinkedList ()SortedLinkedList (LinkNode LinkNode 3)SortedLinkedList (LinkNode LinkNode 33 LinkNode LinkNode 3)SortedLinkedList (LinkNode LinkNode 33 LinkNode LinkNode 13 LinkNode LinkNode 3)SortedLinkedList (LinkNode LinkNode 33 LinkNode LinkNode 13 LinkNode LinkNode 3 LinkNode LinkNode0)
in the Transcript 0064 agan tconfirmsthe Tcorrectness ofour timpementstion
Man tlessons ear.ned
![Page 420: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/420.jpg)
![Page 421: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/421.jpg)
![Page 422: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/422.jpg)
![Page 423: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/423.jpg)
![Page 424: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/424.jpg)
Introduction to Smalltalk - Chapter 11 - Stacks, queues, linked lists, trees, and graphs Ivan Tomek 9/17/00
416
i) Add root
![Page 425: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/425.jpg)
Introduction to Smalltalk - Chapter 11 - Stacks, queues, linked lists, trees, and graphs Ivan Tomek 9/17/00
417
add: 17;add: 49;add: 32;do: [:node | Transcript show: node value printString; cr]
which produces
8142117363249
Main lessons learned:
![Page 426: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/426.jpg)
![Page 427: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/427.jpg)
Introduction to Smalltalk - Chapter 11 - Stacks, queues, linked lists, trees, and graphs
![Page 428: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/428.jpg)
![Page 429: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/429.jpg)
Introduction to Smalltalk - Chapter 11 - Stacks, queues, linked lists, trees, and graphs Ivan Tomek 9/17/00
421
1 <D8 03> push 33 <D8 03> push 35 <DF 00> no-check send +7 <66> pop8 <D8 05> push 510 <CC 00> no-check send factorial12 <45> pop; push self13 <65> return
In conclusion, let’s note that both Parser and Scanner are in the library and you can subclasses
![Page 430: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/430.jpg)
![Page 431: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/431.jpg)
![Page 432: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/432.jpg)
![Page 433: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/433.jpg)
![Page 434: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/434.jpg)
![Page 435: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/435.jpg)
![Page 436: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/436.jpg)
![Page 437: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/437.jpg)
![Page 438: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/438.jpg)
Introduction to Smalltalk - Chapter 12 - Developing user interfaces Ivan Tomek 9/17/00
431
Chapter 12 - Developing user interfaces
Overview
The group of classes supporting graphical user interfaces (GUIs) is one of the most complex partsof VisualWorks and its detailed coverage is beyond the scope of this book. Fortunately, to be able to use thetools for routine applications and to create interesting extensions of the widget library, you only need tounderstand a limited number of concepts, and specialized books are available for more advanced uses.
The first requirement for creating a user interface is to be able to draw objects such as lines,widgets, and text on the screen. VisualWorks perspective is that drawing requires a surface to draw on (suchas a computer screen or printer paper), the graphical objects being drawn, and an object that does thedrawing and holds the parameters that describe the drawing context (such as fonts, colors, and line widths).
Being able to draw an object on the screen is, however, only a part of a typical GUI. Unless thedisplayed windows are completely passive, the user must also interact with them via the mouse and thekeyboard. A user interface must also ensure that the display reflects changes of the displayed data model,and that damage caused, for example, by resizing a window is automatically repaired.
To implement automatic response to model changes and user interaction, Smalltalk uses themodel-view-controller paradigm - MVC for short. The model part of the MVC triad holds data and provides
GUIs-ay reflece to drulical objsxt (suculine wonrks n Tj -36 -1.28 TD /F0 9.96 Tf -0.002 Tc70.057 Tw222The firsomaseto Smaiileddns a-36 -166348 0.0557 T010.8575 130(and threateramet paciplthe diWorks perspenterfaces (GUIsovides) Tj 0 backof cnd114.6 -29rep8.S24f -0.03.804c 0.887remenrfaomiz T32 metplayed wiilontrir 164( aeo)w onrectInols for routine appli, noces lecmmcrejhment autom0 -11.76 T -0.0132 c05.044involvir morese ag contexuteanheeTw0et but 6 Tw (undir ml partse agr of cteaniWofule)interactscr36 -11.76 T6 -0.0009588c72.042Dces (supporting graphical oobject on the sc Tw (asst ctaskhangesiffatenrklodeuael changodenctract wcalt-36 -11.76 09 -0.01328715 1.4631 ffatenrkdnd ogrametction, Smaoutroae outesiffatenrlynnd prs andmet paciplthe dective is that drawing rejhment1 T8 0.0281 Tc a (such) Tj 0 -11.76 f -0.001.925c 1.4631 that dUIs-ay ,aphical oace isof the die that the display realynnetharibe the drawing and hothe paramedel,
![Page 439: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/439.jpg)
![Page 440: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/440.jpg)
![Page 441: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/441.jpg)
![Page 442: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/442.jpg)
![Page 443: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/443.jpg)
![Page 444: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/444.jpg)
Introduction to Smalltalk - Chapter 12 - Developing user interfaces Ivan Tomek 9/17/00
437
• moveTo: is triggered by the Move button via the move method (below). It displaysprompts to select the window to be moved and the destination desk, unmaps the window,and assigns the number of the specified desk to this window in the registry.
• openBrowser and openWorkspace buttons open the Browser and the Workspace.• rename requests a new name for the currently selected desk button and assigns it to the
button as its label.• move asks the user to select a window and click the destination desk button. The internal
assignment of the desk is performed by updateDesk:.• Private support methods.
• updateDesk: is trigga tosupp
![Page 445: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/445.jpg)
![Page 446: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/446.jpg)
Introduction to Smalltalk - Chapter 12 - Developing user interfaces Ivan Tomek 9/17/00
439
| window |(waitingApps at: currentDesk) remove: anApplication.cg816 Tw ( Iow |) Tj -4.92 -1:= TD 0.0557 Tc 0 Tw 3 4.92(curre162ation.) Tj -15
![Page 447: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/447.jpg)
![Page 448: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/448.jpg)
![Page 449: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/449.jpg)
![Page 450: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/450.jpg)
![Page 451: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/451.jpg)
Introduction to Smalltalk - Chapter 12 - Developing user interfaces Ivan Tomek 9/17/00
444
gc paint: paint.startx := (Dialog request: 'Upper left x' initialAnswer: '30') asNumber.starty := (Dialog request: 'Upper left y' initialAnswer: '30') asNumber.side := (Dialog request: 'Side' initialAnswer: '20') asNumber.“Disply.”^gc displayRectangle: (startx @ starty extent: side @ side)
Main lessons learned:
• All display within a window is performed by an instance of GraphicsContext.• GraphicsContext is central to everything related to display of visual components.• In addition to being the drawing engine, a GraphicsContext also holds display parameters such as line
width, paint, and fault.• Display parameters stored in the graphics context can be controlled programmatically.
![Page 452: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/452.jpg)
![Page 453: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/453.jpg)
![Page 454: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/454.jpg)
![Page 455: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/455.jpg)
![Page 456: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/456.jpg)
![Page 457: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/457.jpg)
![Page 458: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/458.jpg)
![Page 459: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/459.jpg)
![Page 460: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/460.jpg)
![Page 461: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/461.jpg)
![Page 462: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/462.jpg)
![Page 463: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/463.jpg)
![Page 464: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/464.jpg)
Introduction to Smalltalk - Chapter 12 - Developing user interfaces Ivan Tomek 9/17/00
457
width := aGraphicsContext widthOfString: string.aGraphicsContext displayString at: (center x ( width/2)) @ 50)]
ifFalse: “Display currently selected image.”[aGraphicsContext displayImage: image at: 0@0]
The program is now fully functional. Note that unlike our previous programs it automaticallyrepairs window damage due to collapsing, reshaping, and other window events.
Improvements
We know that it is better to centralize shared behavior and in our case both image
![Page 465: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/465.jpg)
![Page 466: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/466.jpg)
![Page 467: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/467.jpg)
![Page 468: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/468.jpg)
![Page 469: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/469.jpg)
![Page 470: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/470.jpg)
![Page 471: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/471.jpg)
![Page 472: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/472.jpg)
![Page 473: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/473.jpg)
![Page 474: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/474.jpg)
Introduction to Smalltalk - Chapter 12 - Developing user interfaces Ivan Tomek 9/17/00
467
its components with the clipped GraphicsContext. Each component then redraws that part of itself whichfalls within the clipping rectangle, using the supplied default graphics context parameters or redefining themtemporarily.
Older versions of VisualWorks used polling controllers which repeatedly queried the sensor for UI
![Page 475: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/475.jpg)
![Page 476: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/476.jpg)
![Page 477: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/477.jpg)
![Page 478: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/478.jpg)
![Page 479: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/479.jpg)
Introduction to Smalltalk - Chapter 13 - Processes and their coordination, additional UI topics Ivan Tomek 9/17/00
473
Figure 13.2. Simplified behavior of processes: Stopwatch runs until stopped by Delay. At this pointanother process can start execution and the stopwatch resumes when the one second delay expires.
The Stop button stops the infinite iteration process started by the Start button by sending it theterminate message:
stop"Terminate the process implementing continuous stopwatch operation."
process terminate
stop
Start
![Page 480: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/480.jpg)
![Page 481: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/481.jpg)
![Page 482: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/482.jpg)
![Page 483: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/483.jpg)
![Page 484: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/484.jpg)
![Page 485: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/485.jpg)
Introduction to Smalltalk - Chapter 13 - Processes and their coordination, additional UI topics Ivan Tomek 9/17/00
479
2. Program opens form.3. User enters information and clicks Accept.4. Program closes form, inserts new alarm in the list, and displays the updated list in the main window.
Scenario 2: User edits an alarm in the list1. User selects an alarm and clicks edit
3. UserAccept.3. Program User eects an alarm and clicks .
![Page 486: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/486.jpg)
![Page 487: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/487.jpg)
Introduction to Smalltalk - Chapter 13 - Processes and their coordination, additional UI topics Ivan Tomek 9/17/00
481
Design Refinement
Class Hierarchy
AlarmTool is an application model, and its superclass is therefore ApplicationModel. Alarm does not
![Page 488: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/488.jpg)
![Page 489: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/489.jpg)
![Page 490: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/490.jpg)
![Page 491: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/491.jpg)
![Page 492: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/492.jpg)
![Page 493: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/493.jpg)
![Page 494: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/494.jpg)
![Page 495: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/495.jpg)
![Page 496: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/496.jpg)
![Page 497: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/497.jpg)
![Page 498: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/498.jpg)
Introduction to Smalltalk - Chapter 13 - Processes and their coordination, additional UI topics Ivan Tomek 9/17/00
492
truck process will use the Truck class in a similar way. Process objects thus use domain objects but areseparate from them. With this background, we can now expand Scenario 1.
Scenario 1: Starting or restarting simulation1. User clicks Go.2. TrainSimulation creates a train process and a truck process.3. TrainSimulation starts the train process and the vehicle processes automatically start taking turns
executing single step motion while respecting the semaphore at the crossing.
Scenario 2: Stopping simulation1. User clicks Stop.2. TrainSimulation terminates the two processes.
The immediate question is whether clicking Stop can actually freeze simulation. The point is that User clicks vehicl9.96 Tf 0.0428 Tc 0 Tw (S fr1 TD eingeabe s u.843er) Tj 19.32 P4.1ougF0 9.924oc 9/mov3t T TD r the 28.2 0 tartotion incrosxpl Tjr t -0.01tinsemap4n li.0ti2 -1),greenappli thcow24 12 354. Chang BT 9peed T2545 88 .imu 1h. 74 /F49y fretigle s.024 18 TD eingeabe ss u.843er
![Page 499: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/499.jpg)
![Page 500: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/500.jpg)
Introduction to Smalltalk - Chapter 13 - Processes and their coordination, additional UI topics Ivan Tomek 9/17/00
494
Figure 13.10. Class Hierarchy Diagram with classes to be designed shown as heavy rectangles.
Refined class descriptions
We now understand enough of the behaviors of our classes to be able to start refining classdescriptions:
Domain classes
Vehicle. Abstract superclass of domain classes Train and Truck. Factors out shared behavior and knowledgesuch as vehicle position and direction of motion, calculation of the next position, testing for the end of thetrack or crossing, and turning.Superclass: ObjectComponents: limit (distance from crossing to lights), position (distance of vehicle from start of track),direction
![Page 501: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/501.jpg)
![Page 502: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/502.jpg)
![Page 503: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/503.jpg)
![Page 504: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/504.jpg)
![Page 505: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/505.jpg)
Introduction to Smalltalk - Chapter 13 - Processes and their coordination, additional UI topics Ivan Tomek 9/17/00
499
"Return true if I have just reached the start of the crossing zone."^(direction == #incrementing and: [position = (crossing - limit - vehicleLength)])
or: [direction == #decrementing and: [position = (crossing + limit)]]
and
endOfTrack"Return true if this is the end of the track. Remember that vehicle might have turned."
^(direction = #decrementing and: [position = 0])or: [direction == #incrementing and: [position = (trackLength - vehicleLength)]]
The method that triggers redisplay of semaphore lights uses the same principle as moveOneStepand asks TrainSimulation to display semaphores controlled by the vehicle in the specified color:
semaphores:
![Page 506: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/506.jpg)
![Page 507: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/507.jpg)
![Page 508: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/508.jpg)
![Page 509: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/509.jpg)
Introduction to Smalltalk - Chapter 13 - Processes and their coordination, additional UI topics Ivan Tomek 9/17/00
503
7. Add an animation of a crash of the two vehicles.8. Extend the simulation program to several parallel train and truck tracks with a single shared crossing.
Each track has its own vehicle running at its own speed and each vehicle’s speed is controlledindependently.
![Page 510: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/510.jpg)
Introduction to Smalltalk - Chapter 13 - Processes and their coordination, additional UI topics Ivan Tomek 9/17/00
504
5. User releases the mouse button.6. Program stops dragging the track.
Scenario 3: User drags the left end of the horizontal track to a new position1. User moves the cursor into the hot area surrounding the left end of the horizontal track.2. Program changes cursor to the shape shown on the left of Figure 13.12.3. User presses the <operate> button and moves the mouse while holding the button down.4. Program
![Page 511: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/511.jpg)
![Page 512: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/512.jpg)
![Page 513: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/513.jpg)
![Page 514: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/514.jpg)
![Page 515: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/515.jpg)
![Page 516: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/516.jpg)
![Page 517: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/517.jpg)
![Page 518: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/518.jpg)
![Page 519: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/519.jpg)
![Page 520: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/520.jpg)
![Page 521: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/521.jpg)
The Joy of Smalltalk - Glossary Ivan Tomek 9/18/00
515
File out. Command available in file browsing tools and used to store a method, a protocol, a class, or acategory in a file, using a special form expected by the file in command. Used for transporting source codefrom one computer to another. The command is available in various Smalltalk browsers.Finalization.
![Page 522: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/522.jpg)
The Joy of Smalltalk - Glossary Ivan Tomek 9/18/00
516
Message.Metaclass.Method.Model.Mouse buttons.Multiple inheritance.MVC paradigm.Object.Object file.Optimization.Order of evaluation.Ordered collection.Overloading.Palette.Pane.Parameter.Persostent object.Pointer.Pool dictionary.Po-up menu.Polymorphism.Private method.Primitive method.Private method.Protocol.Pseudovariable.Radio button.Receiver.Return object.Reusability.Selector.self.Semantics.Set.Shortcut key.Signature.Simulation.Single inheritance.
ReSourceolld
S i g t a .
Sigta.ic binng.S i g t r e a
PaSubass.P a S u p e r a s s .seluper Tj T* 0.0082 Tc 0.04523Tw (Theempory.) riable.S i T e x t T j T * 0 . 0 1 9 T c 0 . 0 1 1 T w ( R e T e x t e d i r . ) f w i d g .
![Page 523: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/523.jpg)
The Joy of Smalltalk - Glossary Ivan Tomek 9/18/00
517
Text file.Transcript.UI.User interface.Unary message.Undeclared variable.Value holder.Variable.View.Widget.Wildcard.Window.Workspace.
![Page 524: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/524.jpg)
![Page 525: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/525.jpg)
![Page 526: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/526.jpg)
![Page 527: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/527.jpg)
![Page 528: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/528.jpg)
![Page 529: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/529.jpg)
![Page 530: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/530.jpg)
![Page 531: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/531.jpg)
![Page 532: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/532.jpg)
![Page 533: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/533.jpg)
![Page 534: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/534.jpg)
Introduction to Smalltalk - Appendix 1 - Check Boxes, Radio Buttons, Input Fields, and their applications Ivan Tomek 04/06/2001
10
Exercises
1. Modify our example 1 to display ‘Input text’ in the input field and ‘Output text’
![Page 535: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/535.jpg)
![Page 536: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/536.jpg)
![Page 537: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/537.jpg)
![Page 538: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/538.jpg)
Introduction to Smalltalk - Appendix 1 - Check Boxes, Radio Buttons, Input Fields, and their applications Ivan Tomek 04/06/2001
14
(builder componentAt: #mozzarella) enable.(componentAt: #figs) enable.(builder componentAt: #pineapple) enable.(builder componentAt: #mozzarellaPrice) enable.(builder componentAt: #figsPrice) enable.
![Page 539: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/539.jpg)
![Page 540: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/540.jpg)
Introduction to Smalltalk - Appendix 1 - Check Boxes, Radio Buttons, Input Fields, and their applications
![Page 541: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/541.jpg)
Introduction to Smalltalk - Appendix 1 - Check Boxes, Radio Buttons, Input Fields, and their applications Ivan Tomek 04/06/2001
17
Figure A.1.14. Builder’s bindings dictionary.
Once the
![Page 542: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/542.jpg)
![Page 543: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/543.jpg)
![Page 544: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/544.jpg)
![Page 545: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/545.jpg)
![Page 546: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/546.jpg)
![Page 547: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/547.jpg)
![Page 548: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/548.jpg)
![Page 549: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/549.jpg)
Introduction to Smalltalk - Appendix 1 - Check Boxes, Radio Buttons, Input Fields, and their applications Ivan Tomek 04/06/2001
25
printAndClose
![Page 550: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/550.jpg)
![Page 551: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/551.jpg)
![Page 552: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/552.jpg)
![Page 553: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/553.jpg)
![Page 554: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/554.jpg)
![Page 555: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/555.jpg)
![Page 556: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/556.jpg)
![Page 557: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/557.jpg)
![Page 558: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/558.jpg)
![Page 559: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/559.jpg)
![Page 560: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/560.jpg)
![Page 561: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/561.jpg)
![Page 562: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/562.jpg)
![Page 563: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/563.jpg)
Introduction to Smalltalk - Appendix 2 - Dataset, Subcanvas, Notebook, Dialog Window, Menus Ivan Tomek 04/06/2001
7
Figure A.2.6. The main canvas (left), and the two subcanvases. The subcanvas component of the main
![Page 564: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/564.jpg)
Introduction to Smalltalk - Appendix 2 - Dataset, Subcanvas, Notebook, Dialog Window, Menus Ivan Tomek 04/06/2001
8
![Page 565: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/565.jpg)
![Page 566: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/566.jpg)
![Page 567: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/567.jpg)
Introduction to Smalltalk - Appendix 2 - Dataset, Subcanvas, Notebook, Dialog Window, Menus
![Page 568: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/568.jpg)
![Page 569: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/569.jpg)
![Page 570: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/570.jpg)
![Page 571: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/571.jpg)
![Page 572: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/572.jpg)
![Page 573: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/573.jpg)
![Page 574: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/574.jpg)
![Page 575: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/575.jpg)
![Page 576: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/576.jpg)
![Page 577: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/577.jpg)
Introduction to Smalltalk - Appendix 2 - Dataset, Subcanvas, Notebook, Dialog Window, Menus Ivan Tomek 04/06/2001
21
dirString isEmpty | (dirName := dirString asFilename) isDirectory notifTrue: [^Dialog warn: dirName asString , ' is not a valid directory.']
![Page 578: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/578.jpg)
![Page 579: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/579.jpg)
![Page 580: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/580.jpg)
Introduction to Smalltalk - Appendix 2 - Dataset, Subcanvas, Notebook, Dialog Window, Menus
![Page 581: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/581.jpg)
![Page 582: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/582.jpg)
![Page 583: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/583.jpg)
Introduction to Smalltalk - Appendix 2 - Dataset, Subcanvas, Notebook, Dialog Window, Menus Ivan Tomek 04/06/2001
27
Figure A.2.17. Passive (left) and activated (right) menu button. The passive view may display the currentchoice in the menu. The menu bar at the top of the window has one label.
The distinguishing characteristics of popup menus, menu bars, and menu buttons are summarizedin the following table:
![Page 584: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/584.jpg)
![Page 585: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/585.jpg)
![Page 586: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/586.jpg)
Introduction to Smalltalk - Appendix 2 - Dataset, Subcanvas, Notebook, Dialog Window, Menus Ivan Tomek 04/06/2001
30
Figure A.2.21. Dialog for installing a menu.
![Page 587: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/587.jpg)
![Page 588: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/588.jpg)
![Page 589: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/589.jpg)
![Page 590: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/590.jpg)
Introduction to Smalltalk - Appendix 2 - Dataset, Subcanvas, Notebook, Dialog Window, Menus Ivan Tomek 04/06/2001
34
3. Use the Menu Editor to color the background of the delete
![Page 591: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/591.jpg)
![Page 592: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/592.jpg)
![Page 593: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/593.jpg)
![Page 594: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/594.jpg)
![Page 595: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/595.jpg)
![Page 596: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/596.jpg)
Appendix 3 – Chess board – a custom user interface Ivan Tomek 06/04/01
3
Context Diagram
The major components of the system are the chess board with its pieces and user interface, and theplayers. The players (including a computer program player) are outside of the scope of the task. TheContext Diagram is shown in Figure A.3.2.
![Page 597: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/597.jpg)
![Page 598: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/598.jpg)
![Page 599: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/599.jpg)
![Page 601: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/601.jpg)
![Page 602: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/602.jpg)
![Page 603: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/603.jpg)
![Page 604: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/604.jpg)
![Page 605: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/605.jpg)
![Page 606: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/606.jpg)
![Page 607: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/607.jpg)
![Page 608: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/608.jpg)
![Page 609: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/609.jpg)
![Page 610: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/610.jpg)
Appendix 3 – Chess board – a custom user interface Ivan Tomek 06/04/01
17
iii. How many moves are required for a knight to reach a given square from a given startingsquare?
iv. What is the maximum number of moves for a knight to reach any position on the board from agiven starting square?
![Page 611: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/611.jpg)
![Page 612: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/612.jpg)
![Page 613: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/613.jpg)
![Page 614: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/614.jpg)
![Page 615: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/615.jpg)
![Page 616: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/616.jpg)
![Page 617: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/617.jpg)
![Page 618: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/618.jpg)
![Page 619: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/619.jpg)
Introduction to Smalltalk - Appendix 4 - Classes, Metaclasses, and Metaprogramming Ivan Tomek 04/06/2001
9
String subclasses “Returns #(ByteEncodedString TwoByteString Symbol GapString).”
To find which of all existing arrays has the largest size, evaluate
| size |size := 0.Array allInstancesDo: [:anArray| size := size max: anArray size].size
or more simplyArray allInstances inject: 0 into: [:max :anArray| max max: anArray size]
To find all superclasses of a class, execute allSuperclasses as inSet allSuperclasses “OrderedCollection (Collection Object).”
Instance variable format contains a code that describes what kind of class this is. The protocolbased on format makes it possible to ask a class whether it has fixed size (classes that have only namedvariables) or variable size (collections represented internally as indexed elements) and, in the case of avariable size class, whether its variables are stored as eight-bit or 16-bit quantities. As an example, allvariable size classes can be obtained by
Object withAllSubclasses select: [:aClass| aClass isVariable]
which returns
OrderedCollection (AnnotatedMethod Array BinaryStorageBytes BOSSBytes BOSSReaderMap ByteArray
![Page 620: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/620.jpg)
Introduction to Smalltalk - Appendix 4 - Classes, Metaclasses, and Metaprogramming Ivan Tomek 04/06/2001
10
Functionality based on access to class hierarchy and method dictionary
Behavior provides several methods for adding new selectors to the method dictionary or removing
![Page 621: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/621.jpg)
![Page 622: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/622.jpg)
![Page 623: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/623.jpg)
![Page 624: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/624.jpg)
Introduction to Smalltalk - Appendix 4 - Classes, Metaclasses, and Metaprogramming Ivan Tomek 04/06/2001
14
classVariableNames: ''poolDictionaries: ''category: 'Graphics-Support'
![Page 625: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/625.jpg)
![Page 626: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/626.jpg)
![Page 627: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/627.jpg)
![Page 628: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/628.jpg)
![Page 629: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/629.jpg)
![Page 630: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/630.jpg)
![Page 631: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/631.jpg)
![Page 632: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/632.jpg)
Introduction to Smalltalk - Appendix 4 - Classes, Metaclasses, and Metaprogramming Ivan Tomek 04/06/2001
22
Proxy to insert a programmer action and pass the original message to x
![Page 633: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/633.jpg)
![Page 634: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/634.jpg)
Introduction to Smalltalk - Appendix 4 - Classes, Metaclasses, and Metaprogramming Ivan Tomek 04/06/2001
24
TestOfProxy newWithProxy var: 13; var: 15
![Page 635: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/635.jpg)
![Page 636: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/636.jpg)
Introduction to Smalltalk - Appendix 4 - Classes, Metaclasses, and Metaprogramming Ivan Tomek 04/06/2001
26
Important classes introduced in this chapter
![Page 637: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/637.jpg)
![Page 638: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/638.jpg)
![Page 639: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/639.jpg)
Introduction to Smalltalk - Appendix 5 – Style Recommendations Ivan Tomek 04/06/2001
3
A 5.4 Formatting
Guideline F.1: Use automatic formatting. Since the VisualWorks formatter exhibits some undesirable
![Page 640: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/640.jpg)
![Page 641: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/641.jpg)
![Page 642: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/642.jpg)
![Page 643: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/643.jpg)
![Page 644: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/644.jpg)
![Page 645: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/645.jpg)
![Page 646: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/646.jpg)
Introduction to Smalltalk - Appendix 4 - Projects Ivan Tomek 04/06/2001
2
We want to be able to perform the following tasks:
• Patient record• Add•
![Page 647: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/647.jpg)
![Page 648: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/648.jpg)
![Page 649: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/649.jpg)
Introduction to Smalltalk - Appendix 4 - Projects
![Page 650: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/650.jpg)
![Page 651: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/651.jpg)
![Page 652: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/652.jpg)
Introduction to Smalltalk - Appendix 4 - Projects Ivan Tomek 04/06/2001
8
High level conversation:1. User selects borrower in the catalog and clicks Open.2. System opens a book form with current information about the book.3. User edits the form and indicates end of task by clicking Accept in.
![Page 653: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/653.jpg)
![Page 654: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/654.jpg)
![Page 655: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/655.jpg)
![Page 656: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/656.jpg)
![Page 657: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/657.jpg)
![Page 658: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/658.jpg)
![Page 659: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/659.jpg)
![Page 660: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/660.jpg)
![Page 661: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/661.jpg)
Introduction to Smalltalk - Appendix 8 - Tidbits Ivan Tomek 04/06/2001
2
added to a stream and displayed in the text view, whereas non-normal characters are ‘dispatched’ for further
![Page 662: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/662.jpg)
Introduction to Smalltalk - Appendix 8 - Tidbits Ivan Tomek 04/06/2001
3
global interest), or class variables, or keys in a pool dictionary1. It turns out that they are keys in the pooldictionary TextConstants because they are used by several other classes as well. When you inspect thisdictionary, you will find that Ctrlt ,Ctrlf, Cut, Paste, and BS are among many characters that are assigned
![Page 663: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/663.jpg)
![Page 664: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/664.jpg)
![Page 665: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/665.jpg)
Introduction to Smalltalk - Appendix 8 - Tidbits Ivan Tomek 04/06/2001
6
A ComposedText contains Text and has access to a dictionary of text styles via its TextAttributescomponent (Figure A.8.2). The TextAttributes object does not itself contain the style dictionary but hasaccess to a
![Page 666: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/666.jpg)
![Page 669: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/669.jpg)
Introduction to Smalltalk - Appendix 8 - Tidbits Ivan Tomek 04/06/2001
10
![Page 670: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/670.jpg)
![Page 671: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/671.jpg)
Introduction to Smalltalk - Appendix 8 - Tidbits Ivan Tomek 04/06/2001
12
(fontSize := Dialog choose: 'Which font size do you want?'
![Page 672: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/672.jpg)
![Page 673: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/673.jpg)
![Page 674: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/674.jpg)
![Page 675: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/675.jpg)
![Page 676: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/676.jpg)
![Page 677: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/677.jpg)
![Page 678: toc.prn - Squeak](https://reader031.fdocuments.in/reader031/viewer/2022012017/615b45a902ac4979d76c30a3/html5/thumbnails/678.jpg)