Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
CoWeb Assignment 1
Writing Code (1 point)
num = 0 | (num = 1)
ifTrue: [^ 1].
num < 0
ifTrue: [self error: 'Invalid parameter - Fibonacci function only accepts positive values'].
^ (self fibonacci: num - 1)
+ (self fibonacci: num - 2)
Tracing Code (1 point)
1: | data onlyPositiveNumbers |
2: data := OrderedCollection withAll: #(1 2 3 -4 -5 'error' 6 -7 999 2).
3: onlyPositiveNumbers := [:i | (i isKindOf: Number) and: [i positive]].
4: data := data select: onlyPositiveNumbers.
5: data := data copyUpTo: 999. "not including"
6: Transcript show: data average
1: The temporary variables data and onlyPositiveNumbers are declared.
2: This initializes data to an OrderedCollection containing all the values in the array passed to withAll (i.e. 1,2,3,-4,-5, the string 'error', 6, -7, 999, and 2)
3: onlyPositiveNumbers is initialized to hold a block of code. The block contains a loop that iterates over whatever data onlyPositiveNumbers is evaluated on, returning true for any elements that are positive numbers.
4: The onlyPositiveNumbers block is evaluated on all members of data, and the values that return false are removed from the OrderedCollection. This leaves data containing (1 2 3 6 999 2).
5: A copy of data up to but not including the value 999 is created and stored in data. This leaves data containing (1 2 3 6).
6: First, the average of data is calculated (3). Then, this value is printed to the Transcript.
CoWeb Assignment 2
Use of the Change Sorters
The management of change sets through the use of the SimpleChangeSorter and/or the DualChangeSorter is a convenient way to control changes made to one's code. Through a ChangeSorter, a programmer can examine each method changed in the current change set. This allows for painless reversion to functioning code should a change break something, as well as rapid, centralized browsing all of modified methods, their hierarchies, protocols, senders, implementors, etc. The main difference between the SimpleChangeSorter and the DualChangeSorter is the latter allows users to compare two different change sets in a single window. This can be useful when trying to decide which of several change sets has the specific change one is looking for. Other than this, the two are functionally the same.
To begin using a SimpleChangeSorter, open one in the environment. The window that appears contains a list of change sets in the top left corner, a list of categories within the selected change set in the top right corner, a list of methods in the given category in the middle, and, at the bottom of the window, the current version of the selected method. The menu for:
- change sets allows users to set the current change set, rename the selected change set, browse the methods in the change set in a method browser, browse the entire change set in a changelist browser, and add information such as author and comments to the change set
- classes provides options for browsing the entire class in a system browser, looking at the class' hierarchy or protocol, and examining class variables
- methods presents the users with numerous options for exploration. The set of "browse..." allow the user to open, respectively, a system browser, a hierarchy browser, a method browser, and the protocol of the method. Perhaps the most useful group of options is the bottom set. These options provide acces to methods that use this method, methods that are implementations of this method, the inheritance of the method, and, most useful of all, the versions of a method. The versions of a method is an extremely useful tool that enables a user to look at different points in the history of the changes to a method, facilitating reverting the method to a prior version or just examine what changes have been made since a given time.
CoWeb Assignment 3 (Spring 2006 Final Exam Review)
Object-Oriented Language Design (2 Points)
1. Java, C++, and C# have primitive types. Eiffel, Ruby, and Smalltalk do not. What are the advantages and disadvantages of having primitive types?
The benefits of primitives types in a programming language stem from the fact that primitives are usually implementations of basic machine types, such as integers and floating point numbers. This allows operations on primitives to be very fast and have less overhead when compared to objects, as many common operations on primitives are already implemented in assembly language. Unfortunately, due to the "closeness" of primitives to the machine they are running on, this also breaks a common data model since these primitive data types are not treated the same as all other (object) data types. This exception to the usual operation of types can potentially confuse users and also prevents the implementing language from using useful object-oriented concepts such as message passing on all types.
2. C++ and Java are statically typed. Objective-C and Smalltalk are dynamically typed. What are the trade-offs of static and dynamic typing?
Static typing of variables allows a compiler to know much more about the execution path of a program and, potentially, to catch type-mismatches at compile time. Also, given specific types for variables, compilers are able to generate very specific (and, therefore, fast) code as well as optimize the code better. By only allowing a single type per variable, the ability to use code for unintended purposes is dramatically reduced, which can be considered good or bad dending on the desires of the original programmer. Dyanamic typing, on the other hand, allows for greater flexibility when coding. This is due both to the extensibility of dynamically typed code as well as the increased ease of metaprogramming. Debuggers also become more useful in dynamically typed languages, because the programmer is able to make changes to the code and continue execution from where it errored.
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 usability experts evaluate an interface's compliance with usability principles. This approach can detect a high percentage of usability bugs, increasing in in relation to the number of evaluators, in a relatively short time period. As such, the technique is especially useful during a product's design phase, where potential problems are easily remedied. However, this only tests with usability experts and is not necessarily a good indication of how regular users will try to interact with it. Major issues can be resolved, but quirks particular to the design may still introduce problems, especially if the target group is not technically inclined. Observing users is a different way to gain feedback on an interface and is more indicative of how well expected users will be able to use the product. The model generated by the user can be compared to the intended model of the designers to see where mistakes were made. However, observation of potential users is expensive both in terms of time and resources. Due to the high expense, this method of evaluation is often only used after the product has been finalized. In addition, dealing with non-experts in usability means that it may be difficult to specify exactly what is causing a problem for the user. Selection of which evaluation technique to employ would depend both on what stage of development the interface is in as well as time frame allowed and the amount willing to be spent on the evaluation.
Links to this Page