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

Discussion 4 - Andrew Calvin

In java, each object is created by the keyword new. The "==" is used for testing the equivalence of references to an identical object. The equals method can determine if the contents of two objects are the same. In squeak, "=" tests equality and "==" tests for equivalence. Java uses types such as int and float, but this is not needed in Squeak. The
squeak way to do a while loop is as follows (disregard the "" around the y variable, x = multiply symbol):
" |y| "
y := 5.
[y > 2] whileTrue:[
Transcript show: ((y 2) asString) ; cr.
y := (y - (y x 3)).
The java way to do a while loop is as follows:

int y=5;
while(i>2) {
System.out.println( Integert.toString(i x 2) );
y = y - (y 3);

The java way to do two parameters is done like so:
bob b;

In squeak, a method with two parameters is done this way (disregard the "", x = multiply):

" |b| "


b methodThatHasTwoParameters: 9 second: 5.
Java and squeak also have different behaviors when evaluating a math expression. For example,
int a;
a=1+5 x 6;
in java becomes (disregard the "", x = multiply):

" |a| "
a := 1+(5 x 6).
to arrive at the same result.

Link to this Page