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

coweb assignment 3

History of Object-Oriented Programming

Alan Kay: designed the original Smalltalk at Xerox PARC in the 70s and started the Squeak project at Apple in 1995.
Ward Cunningham: originator of the Wiki, CRC cards, Extreme Programming

Collection Classes
How do OrderedCollection and Set differ?
A set only allows unique items to be added to it, and has no ordering between its elements. An OrderedCollection allows multiple, identical items and preserves ordering.

How do OrderedCollection and Array differ? Why would you use one over the other?
An Array is a SequenceableCollection, and hence removing or inserting elements is expensive, while the OrderedCollection behaves more like a list. You might use the OrderedCollection over the Array if you want your collection to be sorted, or the Array if you don't care about order and want faster iteration.

How do you use a Dictionary? Why is accessing a Dictionary so fast?
A dictionary is Squeak's associative array, which maps keys to values. You would use the at: put: message on a Dictionary to create such mappings. Dictionary access is fast since it is implemented as a hash table.

Object-Oriented Language Design
What are the advantages and disadvantages of having primitive types?
Primitive types are faster, but they are not part of the object hierarchy and cannot be extended.

What are the trade-offs of static and dynamic typing?
Static typing allows more checks to be done at compile time instead of runtime, but requires more processing. Because more type information is available at compile time, the generated code can be optimized so that it runs faster. However, dynamic typed code is easier to debug at runtime.

What are the advantages and disadvantages of using a virtual machine for OO programming?
A virtual machine typically uses byte code as its "machine language", so as long as just the virtual machine has been ported to ru
n on a particular platform, all code written for the language's virtual machine can be run on that platform; so a virtual machine
increases portability. A virtual machine is typically used by interpreters to facilitate interactive programming. Virtual machin
es also make it easy to implement garbage collection for the OO system, but they may not be as fast as compiling to native code un
less techniques like just-in-time compilation are used.

What are the advantages of having closures? Why do some languages not have closures?
Closures allow blocks of code to be passed around like variables. For instance, control structures in Smalltalk use closures. So
me languages do not have closures because they are difficult to implement if the language stores all local variables on a stack.

Links to this Page