Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
- I am a 4th year (plus one semester) CS major - graduating at the end of this semester.
- My specializations are Systems, Networking, Databases, and I have completed a certificate in Information Assurance.
- I have been co-oping with IBM for the past 3 years (5 terms), and am presently working part time with them.
- Upon graduating, I will be working for Northrop Grumman Electronic Systems in Baltimore, MD.
CoWeb Assignment 1
Video Professor: Because reading is HARD.
In learning a new language/environment that is almost completely unlike anything I've encountered, it seems invaluable to have something like this to visually demonstrate features. Although we have seen many of these things used in lecture, it has often been in passing, and it might not be completely obvious when we find ourselves one on one with Squeak.
Squeak Tools Review Solutions
The PDF linked from this page gives a good summary and explanation of several of the tools Squeak has to offer. This includes things such as the debugger (which will undoubtedly be used at some point this semester) and Monticello (to help to do source control). From my experiences, having good, useful tools will often drastically improve productivity, especially in a team environment.
Team OMG-UNITZ!!1` Cases
This is one team's Cases from milestone 2 of their project. In this, they include CRC cards (showing TA's markup and comments) and talk about things they did right, wrong, and things they would do differently. They also give many good pointers on things to do in the design and planning phase of the project - an often overlooked area which can greatly help or hurt the success of a project.
Mini Java-to-Squeak Tutorial
This Case is something that I feel will greatly help myself (and many others). Tech has a history of banging languages such as C and Java, two languages which share a LOT of the same syntax, into its students' heads. In doing so, anything with new syntax (in this case, Squeak) will come as a bit of a shock. This Case attempts to alleviate some of that shock by relating some lines of Java to the equivalent in Squeak. In doing so, something that is (should be) quite familiar by now to something completely new.
Team extends Good implements Skill Cases
In this Case, a team provides a look at MVC and how this important paradigm is executed (through some visual and textual examples). This paradigm is quite simple, yet (in my experiences as a TA) many people fail to grasp it, or execute it incorrectly. It is important to execute it properly so that your interface isn't doing the work of the backend (and vice-versa). This group does this very well by using the example of Pong, its interface, and the backend that drives it.
CoWeb Assignment 2
Writing Code (1 point)
A palindrome is a word or phrase that has the property of reading the same in either direction (ignoring punctuation, spaces, and capitalization). So, for instance, a palindrome newspaper headline when the Red Sox finally won the World Series might have read, “Boston did not sob.” Write the Smalltalk method to determine whether a String is a palindrome. 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. (Hint: Characters respond to the message isAlphabetic.)
The following method was added as an instance method in the String class.
"Answer whether or not a String is a palindrome."
| lettersOnly |
lettersOnly := self onlyLetters.
^ lettersOnly sameAs: lettersOnly reversed.
Tracing Code (1 point)
The following Smalltalk statements are written in a Squeak Workspace. In order from top to bottom, you execute each statement with Alt-p to print its result. Next to each statement, write the result.
1 + 2 * 3 – 4 factorial
a := #(1 2 3 4 5)
#(1 2 3 4 5)
a select: [:i | i odd]
#(1 3 5)
b := a
#(1 2 3 4 5)
a := a reversed
#(5 4 3 2 1)
b collect: [:i | i * i]
#(1 4 9 16 25)
a perform: #at: withArguments: #(4)
CoWeb Assignment 3
Design Patterns (1 point)
A Singleton is used when it is desirable to have a class where only one instance exists at any given time. It works by having a method that is called whenever the instance is to be accessed (such as a getInstance method). If an instance already exists, it is returned to the user. Otherwise, a new instance is created and is stored in the class so that it can be accessed later. Finally, it is returned to the user.
Image from: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/singletondespatt.asp
Virtual Machines (1 point)
From the lecture slides: "Bytecodes are the instructions of the Smalltalk virtual machine". In other words, the bytecode are the lower level instructions that the virtual machine understands and executes in order to perform its functionality. It is useful because it allows you to see the stack of the exact instructions that the VM executes.
Smalltalk code and bytecode translation (also from slides):
^origin + corner/2
5 <00> pushRcvr: 0
6 <01> pushRcvr: 1
7 <B0> send: +
8 <77> pushConstant: 2
9 <B9> send: /
10 <7C> returnTop
Programming (1 point)
The following code is implemented as an instance method in the String class:
"Contracts a string to a given size using an ellipsis."
| firstSubStrLen secondSubStrLen firstSubStr secondSubStr |
(aSize >= self size) ifTrue: [^self].
(self size <= 3) ifTrue: [^self].
(aSize <= 3) ifTrue: [^'...'].
firstSubStrLen := (((aSize - 3) / 2) ceiling).
(firstSubStrLen = 0) ifTrue: [firstSubStr := '']
ifFalse: [firstSubStr := self copyFrom: 1 to: firstSubStrLen].
secondSubStrLen := (((aSize - 3) / 2) floor).
(secondSubStrLen = 0) ifTrue: [secondSubStr := '']
ifFalse: [secondSubStr := (self copyFrom: (self size - (secondSubStrLen - 1)) to: self size)].
^firstSubStr, '...', secondSubStr.
Links to this Page