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

Shakti Chauhan

Stack Overflow

Co-web assignment 3

Q. I)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: Ward Cunningham amd Alan Kay

    - Use of pattern languages
    - Popularized CRC (Class-Responsibility-Collaborations) cards with Kent Back
    - He is also a significant contributor to Extreme Programming, a software development methodology. A great deal of this work was carried out in the first wiki site itself.

    - Worked with Ivan Sutherland on pioneering graphics, applications including Sketchpad.
    - Developed prototypes of networked workstations using Smalltalk.(this was later used by Apple in Apple macintosh)
    - Conceived the Dynabook concepth, which defined the basics for laptops
    - Considered by some architect of the modern windowing GUI

Q. II)Collection Classes (1 Point) Answer the following questions on the different collection classes available in Squeak.
Q.1) How do OrderedCollection and Set differ?
A.1) 'OrderedCollection' is indexed (therefore ordered) by integers, whereas 'Set' is not-indexed (and therefore, not un-ordered).

Q.2) How do OrderedCollection and Array differ? Why would you use one over the other?
A.2) 'OrderedCollection' is dynamic in size, whereas 'Array' is fixed. OrderedCollection would be used when size is dynamic i.e. elements can be added and subtracted. Array is to be used for quicker data structure lookup.

Q.3) How do you use a Dictionary? Why is accessing a Dictionary so fast?
A.3) For example, you might want to map employees of a company to the positions they hold (in the company). You could do this with a hash.
company :=
Dictionary newFrom: {
'bruce' -> 'captain'.
'john' -> 'ltn'.
'tim' -> 'janitor'.
'oboe' -> 'somebody'

Dictionary's functions like arrays, instead of indices (integers) they hash their contents by their key values, for instance the hash values in the above mentioned example are; captain, ltn, janitor, somebody. Accessing Dictionary is fast because it does not go through the whole collection, it can automatically lookup up the correct values based upon
the keys associated with it (the same way arrays use indices as its key values).

Q.III) 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?

A. III) Heuristice evaluation has small set of evaluators, roughly 3-5. The evaluators independently examine the interface and evaluate it against usability principles. It is mainly formative and qualitative.
Positive: good for evaluating systems when they are in the process of being designed, good for qualitative analysis
Negative: The system must be judged by a rather specific list of heuristics

Cognitive evaluation evaluates a design for ease of learning especially via exploring, which requires a detialed prototype. In cognitive through the designers and developers step through the user interface as if they were new users, stopping to ask themselves questions regarding usability along the way.
Positive: Focused on end user (Lets us know how easy a system will be for the end user)
Negative: Requires fairly detailed prototype (the system must be close to finished, if not finished). The intended end user must be known.

Co-web assignment 2

Squeak Debugger:

Debugger is an application that is used to debug (obviously!) programs. Software development is a process and debugging is an integral part of this process. No one (Virtually)can write code without having to debug it. Squeak's environment provides user with it's own Debugger utility. The debugger provides with the following options:-
1. Proceed: Proceed execution of the receiver's model, starting after the expression at
which an interruption occurred.
2. Abandon: Abandon the debugger from its pre-debug notifier
3. Debug: Opens a full debugger view
Squeaks Debugger is also dynamic i.e developer does not have to re-run his code. Developer can modify his code in the Debugger view, save it and proceed. If the current bug (that is being evaluated) is fixed the code runs as normal.

Squeak Debugger shows the bugs in concise form(figure 1):

                          figure 1.

If this format of debugger is not self-explanatory, the user can double click on any line and this takes the programmer to the source code (to the exact
line) where the bug is. The debugger highlights the point of error in color green as in figure 2.


Here the Developer can fix and modify the code while in debugger view and save his changes to the source code. If the developer is still not able to find the point of error, he can traverse through the list of variables (in the third row of debugger) and see if the values are correct. Since everything is an object in Squeak, each variable should have some definte value. This utility (looking at object values) also helps developer in the debugging process. For instance in figure 2., developer can trace the value of buzzMorph, that it is 'nil' and from the debugger view can figure that it is not able to load the image 'buzz.gif' (It is very possible that the file is missing!).

A simple example where DEBUGGER helped during milestone 5.

In our script studio, in the beginning, we did not consider the scenario where user would try to upload a file and select 'CANCEL' i.e not select any file from the file selection menu (figure 3). The contents of the selected filestream were published in the script studio (where user could modify the contents of animation script) but in this scenario our code would attempt to extract the contents of 'NIL' file and that gave an error. The debugger highlights the error (line) in figure 4.

                          figure 3.

We fixed the code by uploading the file 'if and only if' it was NOT NIL:
(fileStream=nil) ifFalse:[tMorph setText: fileStream contentsOfEntireFile.]

                          figure 4.

Co-web assignment 1

(self < 0)
	ifTrue: [^'error'].
((self = 0) | (self = 1))
^((self - 1) fibonacci) + ((self - 2) fibonacci))

You may want to use or: rather than so that both objects aren't evaluated every time - Andrew Sayman

| data onlyPositiveNumbers |
   1. First line declares local variables: data onlyPositiveNumbers
data := OrderedCollection withAll: #(1 2 3 -4 -5 'error' 6 -7 999 2).
   2. Assigns an ordered collection of given variables to 'data'
onlyPositiveNumbers := [:i | (i isKindOf: Number) and: [i positive]].
   3. Assigns 'onlyPositiveNumbers' to the given block of code
data := data select: onlyPositiveNumbers.
   4. It selects only postive numbers from the data ordered collection
data := data copyUpTo: 999. "not including"
   5. Copy all postive numbers that are smaller than 999 (excluding 999). Number contain: 1,2,3,6
Transcript show: data average
   6. Display average of the collection in Transcript, which is 3

Step five is incorrect. copyUpTo: copies all values in the collection before reaching the given one. The original collection was (1 2 3 6 999 2). 2 was left out because it was after 999. - Andrew Sayman


Links to this Page