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

Tyler Breisch

CoWeb Assignment 1

Tracing Code
| data onlyPositiveNumbers |
data := OrderedCollection withAll: #(1 2 3 -4 -5 'error' 6 -7 999 2).
onlyPositiveNumbers := [:i | (i isKindOf: Number) and: [i positive]].
data := data select: onlyPositiveNumbers.
data := data copyUpTo: 999. "not including"
Transcript show: data average

| data onlyPositiveNumbers |

This declares 2 temporary variables, data and onlyPositiveNumbers. By default they are set to nil until they are set to something.

data := OrderedCollection withAll: #(1 2 3 -4 -5 'error' 6 -7 999 2).

This makes the data variable an OrderedCollection with the following elements...
1, 2, 3, -4, -5, 'error', 6, -7, 999, 2
Notice that the Ordered collection allows the adding of any type of Object, not just integers, or something such as Strings.

onlyPositiveNumbers := [:i | (i isKindOf: Number) and: [i positive]].

This is is setting the variable onlyPositiveNumbers to this block. In SmallTalk everything is an object even an entire block of code.

data := data select: onlyPositiveNumbers.

Here we are modifying the contents of data. The select method in OrderedCollection states that aBlock must follow 'select:' this is why
onlyPositiveNumbers became a block above. What happens here is that all the elements of data are passed into the code Block one at a time
and only those that are a 'Number' and is 'positive' are left to remain in the OrderedCollection that is the variable data.
data now contains...
1, 2, 3, 6, 999, 2

data := data copyUpTo: 999. "not including"

This runs through the elements in data and includes everything up to the Integer 999. This way the element 999 is not included.
data now contains...
1, 2, 3, 6, 9, 2

Transcript show: data average

This outputs to the Transcrip the average of all the elements in data. This happens to be 3.

Writing Code

| sum |

sum := 0.

(self < 0) 
	ifTrue: [self error: 'Sorry I have to be Positive'. ].

(self <= 1) 
	ifTrue: [^1].

sum := ((self-1) fibonacci) + ((self-2) fibonacci).

add method in Integer Class, then...

6 fibonacci.

CoWeb Assignment 2

-Implementors of

In order to access and use implementors of you need to be inside a system browser. Next select a Category followed by selecting a Class, then you must select a method in this class. Then press the 'implementors' button and a 'implementors of' menu will open in the world showing you what all implements this method.

Uploaded Image: first.jpg

-Senders of

This is found very much like the implementors of function. In order to access and use the senders of function you need to be inside a system browser. Next select a Category followed by selecting a Class, then you must select a method in this class. Then press the 'senders' button and a 'senders' menu will open in the world showing you all the methods that call on this method.

Uploaded Image: second.jpg

-Method Finder

In order to use the method finder you must access it. To this first right click anywhere in the world and choose open. Then click method finder, this will open the method finder which can help you find any method. It's basic functionality is the following; 'You supply inputs and answers and the system will find the method'.

Uploaded Image: third.jpg

CoWeb Assignment 3

Collection Classes (1 Point)
Answer the following questions on the different collection classes available in Squeak.

1. How do OrderedCollection and Set differ?
2. How do OrderedCollection and Array differ? Why would you use one over the other?
3. How do you use a Dictionary? Why is accessing a Dictionary so fast?

OrderedCollections and Sets are both Bag types, but they differ in a few ways. First of all an OrderedCollection allows the user to create more unique lists than does a Set by allowing multiple inclusions of objects. With a Set multiple inclusions of an object are not allowed. Also an OrderedCollection allows users to add new objects to the list in a linear order. When using a Set, added objects are randomly placed within the list.
OrderedCollections and Array's differ in that an Array is of a set user set size. An OrderedCollection dynamically grows and shrinks according to the data within it. WHY???
A Dictionary in Smalltalk is basically a Hashmap. Every entry includes data and a 'key'. This key is very much like a pointer in C, whereas it points directly to where the entry is. This allows for extremely fast access of the Dictionary because when queried for data, the Dictionary just looks at the key associated with the data and retrieves the entry. This makes traversing a complex data structure unnecessary.

History of Object-Oriented Programming (1 Point)
Pick two of the following four people and briefly describe one of their main contributions to object-oriented programming and design: Kent Beck, Ward Cunningham, Alan Kay, and Ivan Sutherland. (Note: Do not describe more than two.)

(1) Kent Beck
Mr. Beck contribution to Object-Oriented Design and Design is huge, relevant, and Extremely(no pun intended...) important to this class in general. Kent Beck's main contribution is the founder and creator of the glorious design process that is, Extreme Programming. His other contribution his infinite wisdom created is CRC Cards. One could surmise that without the birth of Kent Beck this class might not even exist! Thank you Mr. and Mrs. Beck. :)
(2) Ivan Sutherland
Mr. Sutherland developed the Sketchpad, a revolutionary computer program that utilized the first graphical user interface. Thus Sutherland was a pioneer of Human-Computer Interaction and Design. The backend of the program was one of the first programs to utilize "objects" and "instances" in computing.

Usability (2 Points)
You've learned about three usability evaluation techniques in this class: heuristic evaluation, cognitive walkthrough, and observing users. Compare and contrast two of these. What are the strengths of each approach? What are the weaknesses? When are they appropriate to use? Why would you choose one over the other?

Heuristic Evaluation is the process of having someone evaluate your interface and design using a set of Heuristic principles. This technique is excellent in finding usability bugs, but can be misleading because the individuals typically assigned to this task are experts, and are specifically looking for a few bugs. These 'experts' are not representative of the typical user. Using this technique does get a large number of bugs out of the system during the design phase however, which is when this approach is typically used; another one of its advantages. Observing users is a great way of cleaning out the last usability bugs of your program, however this approach is typically and should only be used when the program or software is near completion. The bugs you can work out through this process are very typical of what the end user will normally come across. However this approachs major drawbacks are the cost and resources needed. An abundance of man hours is needed to watch the users of the program. These users also might not have enough technical jargon to accurately describe the problem they are facing.

Link to this Page