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.
"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."
- "Dynamic dispatch vs. static dispatch" - Dynamic dispatch is when the mapping of a message to code is done at runtime. Where static dispatch is done a compile time.
Smalltalk (dynamic): 5 isString - This would go up the heirarchy to Object to find the method at runtime.
eiffle (static): my_array.put (0, 1) - This would find the code to call put when compiling based on my_array.
- "Single dispatch vs. multiple dispatch" - Single dispatch is where the the code gets called based on the type of receiver object. In multiple dispatch its based off all of the objects. Smalltalk (single): 5 + 4 - the + method is called in the small integer class because that is the type of 5
Common Lisp (multiple): (execute system file) - the execute method calls code based on both the type of system and file.
- "Dynamic typing vs. static typing" - With dynamic typing a variable can be assigned any type of object, but with static typing only one type of object can be assigned to a variable.
Smalltalk (dynamic): foo := 1. foo := ''. - this variable can contain a number or a string.
Java (static): int x; x = 0; x = 'bar' = error - x can only be assigned objects of integer type.
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."
- The gulf of execution is the 'gap' between the user's goals and the application's means of obtaining them. Where as the gulf of Evaluation is the gap between what information the system provides to the user about its state and how the user interprets that information (incorrectly).
- An example of the gulf of execution is saving a jpeg in photoshop. Suppose you have a new file and you want to save it as a jpeg. Assuming you have never used the program before you would probably assume you can go to file save, select a file name, and select a file type and hit save. However, depending on the settings, you can get prompted for one to many other settings after clicking save to actually complete the save.
- An example of the gulf of evaluation is grade posting system. Suppose there is a grading system that provides the users the total number of points they obtained on a certain assignment. Now, if that system didn't provide a 'out of X' after the number its possible that a user who received 30 out of 30 only sees that they obtained a 30. The user probably would misinterpret this as 30 out of 100.
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?"
- Refactoring is basically going back and improving the design and readability of code to make it easier to maintain without adding any new functionally (two steps back two steps forward). Fixing ugly code and changing old code to better match an evolving design allows for cheaper and easier maintenance of code. If you avoid refactoring on a large project the code can become overly complex, difficult to change, error prone, etc. Two good signs that you need to refactor are long methods and methods/attributes that don't seem to make sense.
- When ever you change code you run in to the possibility of breaking previous functionality. Since refactoring results in a lot of changed code, Unit testing helps to ensure that you don't break anything after you refactor.
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."
- It's desirable because its more maintainable. It reduces information sharing and can support multiple views on the same model. You can ideally change the view without touching much of the model, or change the model without touching much of the view.
- The model announces a change in a certain portion of itself, and a dependent view checks if they should update.
CoWeb Assignment 1
- Index of Tutorials and Generally Cool Squeak Things
For me, one of the most time consuming things to do when learning a new language is to make a good list of resources to learn/reference from. It really speeds up the process. Also tutorials in general can give an interesting outlook for approaching a certain problem (usually because of experiance in the language).
- Proper CRC Card Creation
Since the use of crc cards is a new concept to me, having a brief explanation of them is quite useful. Plus its nice to distinguish the difference between uml and crc for those coming out of 2335.
- How to make good CRC cards and Scenarios
Another useful crc reference. This one provides a good example of how to do one wrong, and ways to correct it. Also, it outlines good ways of thinking for making scenarios.
- VMs and Bytecodes
Simple break down of Virtual Machines, detailing the differences/similarities of Java and Squeak. Not incredibly useful, but this kind of stuff interests me, probably because its closer to systems stuff :).
Links to this Page
- Summer 2006 Who's Who last edited on 3 September 2007 at 8:57 pm by adsl-215-134-227.aep.bellsouth.net
- Snakes On A Plane last edited on 7 June 2006 at 10:21 am by lawn-199-77-212-183.lawn.gatech.edu