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

Summer 2006 Midterm Review

For this CoWeb assignment, you will complete a midterm review. First create yourself a page on the Summer 2006 Who's Who page, if you haven't already done so. Then, on your page, answer one or more of the questions below. You will need to answer enough questions to get you to a total of 2 points. That can either be two smaller questions or one large question. The TA will be grading for effort and the quality of the answers. You should be able to use your fellow classmates' answers to study for the midterm exam. Make sure that you clearly indicate which question(s) you are answering. Most of these questions are from previous exams, so they are a good sample of the kind of questions that will be asked on the midterm exam.

CRC Cards (2 points)

Using CRC cards, design a shared calendaring system. Any person can create a calendar event. That calendar event should have a name, date, time, and duration. It should also indicate who is supposed to attend the event. In case there is a conflict (e.g. double booking) when an event gets created, the person creating the event should be informed. Before an event is supposed to happen, the attendees should be e-mailed a reminder. Your calendaring system should allow for recurring events, such as a MWF lecture; a user shouldn’t have to enter different events for the different days. (Advice: Don’t get stuck on details we did not include; instead, focus on solving the problem using the requirements given to you.)

Inheritance (1 point)

Answer the following questions on object-oriented inheritance:

Refactoring (1 point)

Answer the following questions on refactoring.

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.

Scoping (1 point)

In an OO language, it is important to have rules for how the objects can communicate. In Java, you can assign variables and methods to be public or private. This indicates what elements of the internals of an object any other object can access (i.e., what is public) and what elements cannot be accessed (i.e., what is private). Consider the scoping rules of Smalltalk. What are the default access rules for instance variables in Smalltalk, and how can a programmer allow or restrict access to the instance variables for a given class of objects? What are the default access rules for instance methods in Smalltalk, and how can a programmer allow or restrict access to instance methods for a given class of objects. What are the advantages and disadvantages of the Smalltalk model compared to the Java model?

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.)

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)

a select: [:i | i odd]

b := a

a := a reversed

b collect: [:i | i * i]

a perform: #at: withArguments: #(4)

Message Passing (1 point)

Smalltalk is built on a few uniform design principles. One of these is that computation happens through message passing: An object gets sent a message (perhaps with some arguments) and returns an object. Even traditional control structures (while loops, for loops, if/then/else) are implemented through message passing. For each of the control structures below, translate the Java code into Smalltalk. For each part, indicate what is the object, what is the message, and what are the arguments.

while loop
while (aBooleanTest)
   // do stuff

for loop
for (i = 1; i <= 10; i++)
   // do stuff

if (aBooleanTest)
{   // do stuff
{   // do stuff

Post questions to the newsgroup.

Links to this Page