SDSU CS 535 Object-Oriented Programming
Spring Semester, 2003
Assignment 1
    Assignments Index        
© 2003, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 28-Jan-03

Assignment 1

Due Tuesday February 4

1a. The VisualWorks home is the directory containing the VisualWorks bin and image directories. On Rohan this is /opt/smalltalk/vw7nc. What is your VisualWorks home directory?

1b. What directory is your version of VisualWorks using as the VisualWorks home? (Look at the “File” menu in the Launcher.)

1c. Open a System Browser and find the String class. Look at the method runLengthFor: in the accessing protocol. Now change the VisualWorks home setting so it is not correct. Then deselect and reselect the method runLengthFor: in the fourth list pane from the left in the System Browser. What happens? Now set the VisualWorks home to the correct value and deselect and reselect the method runLengthFor:. What happens?

2a. Which Launcher menu contains an item to allow you to find implementations of a method?

2b. Which class(es) implement the method nextPutAll: ?

3a. Which Launcher menu contains an item to allow you to find the senders of a method?

3b. Which method(s) send the message useSmallPaletteAlgorithmFor: ?

4. Add the following method to the String class in converting protocol category.

asPalindrome
   ^self , self reverse

What is printed when you evaluate the following expression in a workspace using “Print It”?

‘cat’ asPalindrome

5. Exit VisualWorks and save the image as CS535. You should now have two images with different names: CS535.im and visualnc.im. Start VisualWorks with the image visualnc.im and search for the method asPalindrome in the String class. Can you find it? Exit VisualWorks and start VisualWorks with the image CS535.im and search for the method asPalindrome in the String class. Can you find it?

6. When you find the method asPalindrome file it out using the “File Out as...” item in the “Method” menu of the System Browser. Use the VisualWorks File Browser to open the file you just saved. What is the first line of the file?

7. Open the settings window by selecting the “Settings” item in the “System” menu of the Launcher. Find the “File-out Type” tab (it is near the bottom of the window, you may have to enlarge the window or “scroll” the window to see it). Change the file-out format to Smalltalk chunk source code. Now file out the method asPalindrome again. What is the first line of the file now?

8. Modify the size method in the Integer class to return the number of digits in the receiver. Turn in a copy of your method.


Copyright ©, All rights reserved.
2003 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.

    visitors since 28-Jan-03