Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
CoWeb Assignment 2 –
Debugger – The Debugger is a useful tool because it allows you to change and edit the errors in your code while the code is running.
The top of the debugger window is the error that was given.
The top window of the debugger is the stack of messages that was called when the code was running.
The message with the “” by it is the message that squeak suspects threw the error.
Once you select the message you want to look at the code of the message appears in the next window. Squeak highlights for you which part of the code it thinks through the error. In the 2nd window from the top (where the code from the message is shown) you can edit your code and save it. After that you can restart your program to see if you fixed the error or not or if there is a new error.
Below this window are 4 smaller windows. In the left most window you can select “all inst vars” which will show you all of the instance variables for the message in the window directly to the right of it.
In the next window (the window 2nd from the right) you can select “all temp vars” and this will bring up all of the temporary variables for the selected message in the right most window.
CoWeb Assignment 1 –
Class based inheritance is really quite simple. First off, what is a class? A class is a type of variable
designed by the programmer. A class is an object also. It defines how to build new objects of the same kind and acts as a blue print
of that object, such as a car factory builds cars.
An Object is an instance of a class and the class it's An instance is
an instance of defines the behavior and properties of the object.
a specific representation an object. Their behavior is the same of the object they are an instance of but they each contain their
own sets of data, although it's possible for the sets of two instances to be similar or equal.
In Smalltalk, the difference between class methods and instance methods is that only instance methods
can be used on the instance of a class. Instance methods change the current object's instance variabls,
and have access to class variabls. Class methods can only change class variabls. Also, classes only respond
to messages with class methods and instances only respond to messages with instance methods.
Writing Code: Where is this code inserted?
"Takes in a number and gives back the Fibonacci number"
"This tests to see if the number is less than 0. If it is it passes an error message"
(num < 0)
self error: ['Must be a non negative number']
"This tests to see if the Number is 0 or 1, if it is it returns 1"
(num = 0 | 1)
"if the number is >1 then it adds the number to a fib series"
(num > 1)
^((self fib: (num - 2)) + (self fib: (num - 1)))
Link to this Page