Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
CoWeb Assignment #3:
Object-Oriented Language Design (2 Points)
3. Most OO languages run on a virtual machine. Java and Smalltalk do. C++ does not. What are the advantages and disadvantages of using a virtual machine for OO programming?
A virtual machine offers two distinct advantages: system independence and security. System independence means that the program can be written only once, and run on any platform, making it very portable. It also is very secure because the VM prevents it from damaging other files or applications. It is disadvantageous, though, because since it is separate from the operating system, it can't use special operating system functions. Also, it is much slower than using binary code.
1. Java, C++, and C# have primitive types. Eiffel, Ruby, and Smalltalk do not. What are the advantages and disadvantages of having primitive types?
Primitive types are usually part of the machine the program is running on, which means that operations with these specific types can be executed very quickly without having to do too much manipulating. Also, primitaves are very good for wrapping in classes and putting into arrays, because they can be placed and indexed without having to be pointed to. However, this does take away for an object-oriented design, and breaks the flow of code.
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 evaluations are very good for picking apart every aspect of an interface and puting it through rigerous tests to make sure it is stable and unfallable. It is also very easy to find a majorty of usability errors in a relavitely short amount of time. However, just because all the generic usability features are tested, does not mean the product is ready to be released to the general public, who will not be checking for these problems, but rather, finding ones of their own. For this, obeserving users is a better choice. When you observe a normal user using your interface, you will be able to see exactly what they are thinking about (if they say their actions and thoughts out loud) and doing, so you can plan a step ahead to avoid potential problems. But unless you observe every user that is going to use your program, there is no way to tell how it's going to perform.
CoWeb Assignment #2:
Squeak's debugger is very well designed and when used correctly, can help you solve your errors quickly and efficiently. When a running process encounters an error, the debugger pops up telling you a small summary of the error and asks what you want to do next:
Clicking on the Debug button or clicking in the middle somewhere will bring up a more indepth overview:
Each line at the top is the call stack, and where each message originated. If you see your error immediately, you can edit it right there and complile it on the spot and continue with your program. The last piece of helpful information is the boxes at the bottom of the debugger. It has all the current variables and attributes. It can also show variables just from the current context, or all instance variables total. Using this will help you find your errors fast, and even probably show you other problems with your code that you'll encounter later on. Pressing the Proceed button will move you on to the next line of code, and see if that helps you at all, too.
CoWeb Assignment #1:
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 - delcares the temporary values 'data' and 'onlyPositiveNumbers'
2 - a new OrderedCollection is created with the values 1, 2, 3, -4, -5, 'error', 6, -7, 999, and 2 and data now references that
3 - onlyPositiveNumbers is set as a block of code that loops through a set and returns true for only items that are numbers and are positive
4 - data gets passed the 'filter' that onlyPositiveNumbers contains and now only holds numbers that are positive from the original set
5 - data is now 'filtered' with a new filter that only leaves numbers up to but not including 999 in it
6 - the transcript displays the average of all remaining values in the set
Writing Code (1 point)
(num < 0) ifTrue: [self error: 'Error: only positive values'].
(num = 0) ifTrue: [ ^1 ].
(num = 1) ifTrue: [ ^1 ].
^ (self fibonnaci: (num - 1)) + (self fibonnaci: (num - 2)).
Links to this Page