Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Spring 2006 Midterm Review
For this CoWeb assignment, you will complete a midterm review. First create yourself a page on the Spring 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 TAs 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.
CRC Cards (2 points)
From last semester's final:
Design an on-line ticketing system using CRC cards. At the on-line store, the customer can add any number of tickets to his order. When the customer has finished picking tickets, he can check out using a credit card. The tickets will be sent in the mail. Every ticket is for a specific show, with a set venue, date, and time. Depending on the venue and the particular show, tickets can be assigned to a specific seat, an area (the pit), or general admission. If the customer is purchasing multiple specific seats, the system should try to find available seats that are next to each other. The show should not be oversold. The owner of the venue(s) should be able to collect the money made through ticket sales from the system. The owner should also be able to add new shows to the ticketing system.
Class-Based Inheritance (1 point)
What is a class? What is an instance? How do the two relate? In Smalltalk, what is the difference between class variables and instance variables? In Smalltalk, what is the difference between class and instance methods.
Message Passing (1 point)
What is message passing and how does it fit into the way you program in Smalltalk? How does message passing work together with the class-based inheritance? What are some of the advantages and disadvantages of method passing?
Language Features (1 point)
Squeak is perhaps the least well documented programming language you will ever use; however, Smalltalk and the Morphic GUI compensate for this by being pokable (easy to explore). There are many language features and tools for exploring Squeak. For four of these, name them, describe how you use them, and explain why they are useful.
Writing Code (1 point)
Implement a method in Squeak that will give you the nth Fibonacci number. For both 0 and 1, the Fibonacci number equals 1. From then on, the next in the series is simply the sum of the previous two in the series (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, etc.). Return an error when applicable. Your code should be based on good OO-style and be an efficient algorithm.
As a suggestion, write the code in Squeak. Then, once you have debugged it, you can post it to the CoWeb by surrounding it with <code> and </code>
Tracing Code (1 point)
The following code solves the rainfall problem, which you may have seen in previous CS classes. For each line, describe what the Smalltalk code does. Be as specific as possible. In particular, what is data at the various points in the code?
| data onlyPositiveNumbers |
data := OrderedCollection withAll: #(1 2 3 -4 -5 'error' 6 -7 999 2).
onlyPositiveNumbers := [:i | (i isKindOf: Number) and: [i positive]].
data := data select: onlyPositiveNumbers.
data := data copyUpTo: 999. "not including"
Transcript show: data average
Unit Testing (1 point)
What are the setUp and tearDown methods used for in SUnit testing? Give an example of where you would have to use a tearDown method. Though SUnit and JUnit are the same frameworks, they work a bit differently. Explain why they work differently. Comment from Gregory
Swing as MVC (1 point)
Swing is conceptually based on MVC (Model-View-Controller). Where is each part? Are models the same as in Squeak? Are views the same? Where is the controller? How are dependencies handled?
Post questions to the newsgroup.
Links to this Page