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


I'm a second year CS student specializing in systems (and maybe other stuff). I co-op for GTRI (ESD) doing php/oracle/unix/etc.
As far as hobbies go, I draw and recently got in to photography, but I don't spend enough time doing either.

CoWeb Assignment 3 - NOT FINISHED

Programming (1 point)

"Write a Squeak method that contracts a string to a certain size by inserting an ellipsis (…) in the middle of the string. So, contracting ‘I am the Walrus’ to a size of 11 equals ‘I am…lrus’ (4 beginning characters + 3 periods + 4 ending characters = 11 total characters). Your method should deal with special cases, such as when the string is short enough that it doesn’t need to be contracted. This code should not just function properly, but use good object-oriented style. To that end, be sure to identify the class in which the method is implemented and whether it is an instance or a class method."

The following code should go in to the String class as an instance method.
contract: size
  "contracts a string down to 'size' by replacing middle content with ellipsis"
  | leftEnd rightStart |
  (self size <= size) ifTrue: [ "test to see if string is smaller than provided size"
  (4 >= size) ifTrue: [ "test to see if ellipsis need to be used"
    ^self copyFrom: 1 to: size.
  "else calculate left end index and right start index and produce a string with ellipsis"
  leftEnd := size // 2 - 2 + (size \\ 2).
  rightStart := self size - (size // 2) + 2.
  ^ (self copyFrom: 1 to: leftEnd) , '...' , (self copyFrom: rightStart to: (self size)).

Object-Oriented Language Design (1 point)

"In this class, we introduced a variety of object-oriented languages (Smalltalk, C++, Objective-C, Java, C#, Ruby, Eiffel, CLOS) and their language features. For each of the parts below, explain how the two approaches differ. Then, from the languages mentioned above, give one example of each case."

Usability (1 point)

"Don Norman provides a simple framework for explaining the interaction between people and the physical world. As part of that framework, he identifies two “gulfs”: the gulf of evaluation and the gulf of execution. Describe these and provide an example of each gulf in a situation of a user interacting with a computer application."

CoWeb Assignment 2

Refactoring (1 point)

"Briefly, describe what refactoring is and why would you do it. In your description, include two signs that code should be refactored and how you would go about refactoring the code."
"How can unit testing be useful when refactoring code?"

User Interfaces (1 point)

"In the Model-View-Controller paradigm, there is a clear separation between application semantics (the Model) and the input-output behavior (View and Controller). Why is this separation desirable? Describe the mechanics of MVC that allows for minimal dependence between a Model and its View."

CoWeb Assignment 1

Links to this Page