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

Andrew Durso

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.
Uploaded Image: DursoTitle.jpg



The top window of the debugger is the stack of messages that was called when the code was running.
Uploaded Image: DursoTopWindow.jpg



The message with the “[]” by it is the message that squeak suspects threw the error.
Uploaded Image: DursoErrorMsg.jpg



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.
Uploaded Image: Durso2ndWindow.jpg



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.
Uploaded Image: DursoInstVars.jpg

Uploaded Image: DursoInstVarsWindow.jpg



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.
Uploaded Image: DursoAllTempVars.jpg

Uploaded Image: DursoAllTempVarsWindow.jpg







CoWeb Assignment 1 –

Class-Based Inheritance:
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 of defines the behavior and properties of the object.
An instance is a specific representation
of
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"
fib: num

"This tests to see if the number is less than 0. If it is it passes an error message"
(num < 0)
	ifTrue: [
        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) 
	ifTrue: [^1].

"if the number is >1 then it adds the number to a fib series"
(num > 1) 
	ifTrue: [
        ^((self fib: (num - 2)) + (self fib: (num - 1)))
        ].


Link to this Page