View this PageEdit this Page (locked)Attachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Discussion 3 - Hai Phan (gtg394v)

Part 1: In detail, describe a problem that you experienced in Squeak. What was the problem? Why did it happen? How did you eventually overcome this problem?



The problem that I have experienced in Milestone 2 was comparison between two strings in Squeak. In my "keyStroke: evt" method, I tried to check when the user hits the backspace key by comparing two strings using the operator "==".
The code was:
        ((evt value asString) == 'keystroke <backspace>') ifTrue: [Transcript show: 'true']

But what I tried to do was totally wrong. The word "true" was never printed out to transcript. I though squeak was powerful enough to distinguish between integer comparison and string comparison by using the same "==" operator, since there is no variable type in squeak. However, I forgot that squeak only executes commands by sending messages.

I could not figure out the problem for 45 minutes until one of my group partner, Trung (the computer geek), came and said that "Do it as you do in Java." He was right! Squeak uses method "compare:" to compare two strings.
        ((evt value asString) compare: 'keystroke <backspace>') == 2) ifTrue: [Transcript show: 'true']


Part 2: Read Other Posts and Pick a Good One?


I totally agree with Laura Parker's point of view. Saving current working method before we can switch to another method frustrated me a lot to familiar with Squeak. When I am coding on Squeak, my left hand is just for using hot key Alt-S that is not as regular windows applications hot keys (Ctrl-S). Now, I know how to get rid of this situation thanks to the "invention" of Laura. "I can just have multiple System Browsers open at the same time".

I find Ashley Durham's discussion useful to me. The method finder that Ashley introduced is exactly what I am looking for. In M1 and M2, I always scrolled all methods in System Browser to look for the one I need. This took me a lot of time. Now, with this tool, I think I can search for millions of methods in one minute :). Thank you, Ashley.

Links to this Page