Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Juan Carlos Kuruvilla
Class-Based Inheritance (1 point)
A class is an object that describes a particular "kind" of object. An instance of a class is an object described by that class. While both classes and instances are objects, instances are the basic "things" that are used to accomplish goals in Smalltalk code, while classes simply define how those instances behave and what information they contain.
When a class is created, its definition includes instance variables and class variables. Instance variables are variables that every instance of that class can access. Each instance has a unique copy of such a variable. Class variables, on the other hand, are unique to the class itself. There is only one copy of such a variable for the entire class.
Similarly, instance methods can be accessed by instances of the defined class, while class methods are accessed by the class object. Of course, in this case, there are not multiple copies of instance methods (as for instance variables), since methods are just code that can be executed. The "instance" description simply refers to accessibility.
Message Passing (1 point)
Message passing is the basis for all actions in Smalltalk code. It involves sending a "message," which can be thought of as simply a method name, to an object, along with the appropriate number of arguments for that method. The message must be one which the target object will recognize. The arguments for the message are other objects (since everything is an object in Smalltalk).
The target object recognizes the message if a method with the same name has been defined for its class or some class from which it inherits. When a message is passed, the runtime environment (in our case, the Squeak VM) goes up the inheritance tree to see whether such a method has been defined. If so, that method is executed with the specified arguments. Otherwise, an error is triggered.
An advantage of basing all code on message passing is that it allows for a completely object-oriented language and API. Every variable "type" is a class and can therefore inherit from other classes or be subclassed itself. A disadvantage is that the method lookups for every action can take more time than a simple low-level function call, but this is generally not noticable except for applications that require very high performance.
History of Object-Oriented Programming
Alan Kay was one of the pioneers of OOP. His dissertation focused on FLEX, the first attempt at an object-oriented programming system. His interest in OOP was inspired by Sketchpad and Simula. He also helped to start the open source Squeak project while he was working at Apple.
Ivan Sutherland developed the Sketchpad software that inspired Kay. Sketchpad was the first object-oriented graphics editor, rather than a programming language.
How do OrderedCollection and Set differ?
The items in a Set are not arranged in any particular order. They do not have positions associated with them, so this structure matches the mathematical definition of a "set." In an OrderedCollection, each item has an associated position (index) in the range [1...n], where n is the number of items in the OrderedCollection. Furthermore, a Set actively checks for distinctness among the objects added to it. A Set stores any given object only once.
How do OrderedCollection and Array differ? Why would you use one over the other?
Since Array is a subclass of ArrayedCollection, it is immutable. This means that although instances of it can be produced by various class methods or other operations, one can not add or remove items to an Array object directly. To "add" to an Array, it must be replaced by a new Array object produced by a method such as #with:. An OrderedCollection, on the other hand, supports the #add: and #remove: methods.
How do you use a Dictionary? Why is accessing a Dictionary so fast?
A Dictionary is a set of associations between keys and values. Each key in a given Dictionary is unique. Items in Dictionary objects are found by passing a key to the #at: method, which returns the associated value. Items are added with #at:put: method. Accessing a Dictionary is fast because it uses a hash table to store items. A hash table an object's hash value to assign it a position in the table. These positions are not known externally, but are used by the Dictionary to very quickly access the value at a given key.
Heuristic evaluation involves reviewing software while considering a set of heuristic guidelines. These heuristics are basically questions about the software interface, such as "Can the user figure out the current state?". Observing users, such as in a think-aloud session, involves getting feedback directly from a user about his/her experience while using the software. Specifically, in a think-aloud session, the user literally speaks his/her thoughts while working through a given task.
Heuristic evaluation provides a very systematic way to test whether software meets general guidelines discovered by years of HCI research by professionals. In contrast, think-aloud sessions can be much less systematic, and observing the user can actually change what he/she does. However, an advantage of observing users is that it is more likely to reflect a typical user's experience with the software, since programmers do not generally think like non-programmer computer users when interacting with software.
Link to this Page