Software Design (CS223 2004F)

Class 40: Takehome Discussion

Back to Design Patterns (4): Structural Patterns . On to Design Patterns (5): Behavioral Patterns.

Held: Monday, 6 December 2004

Summary: Today we belatedly consider various issues related to the take-home midterm examination.

Related Pages:



Introductory Notes

On the front of your sheet, you'll see the grades for the various problems as well as your total grade. For each problem, I list just the "delta" from the base score of 25. For example, -3 means you got 22/25 and +1 means you got 26/25. I then list the possible extra credit: "name" means you wrote your name at the top of each sheet, "times" means you told me how long you spent on each problem, "errors" means you got credit for the too-many errors I included, and "jello" means you got credit because my kids spilled jello on your exam.

I also included a "midterm" grade, which was computed by averaging 2/3 of your higher of the two midterms and 1/3 of the lower of your midterms.

The exam took most of you much longer than I'd planned (primarily because many of you had more difficulty with introspection than I'd expected). However, many of you failed to write "There's more to life than CS" on your exam. However, I still imposed my "minimum grade" policy on all exams.

As most of you discovered, my exams generally ask you to apply the skills you've learned in the class to new, but related material (e.g., reading information on the Java Collections Framework and refactoring) and to pply the knowledge you've learned to related problems. It seems most of you were successful at learning the new topics. (I hope having to diagram the JCF will make you more facile at using it.) However, a number of you had problems with introspection. (About half the class got it; about half didn't.) When your code doesn't compile, you really should come to me for help.

Notes on Collections Framework

Under the There is more to life than CS rubric, I did not grade this problem in detail. (I glanced at each of your answers, but that is all I had time for.) Everyone therefore received full credit for this problem (unless he or she failed to turn it in).

Building Factories

I expected this to be a straightforward problem. One technique is to have a helper class that remembers the Constructor and just calls it. Another is to use anonymous inner classes and override the parse method to use the appropriate constructor.

The trickiest part if you use anonymous inner classes is that you need to make sure that the class is final.

Notes on Introspective Testing

This was clearly the most time-consuming and difficult of the problems (although I had not intended it to be so).

A few of you tried to use the caret symbol (^) for exponentiation. Unfortunately, that's the bitwise exclusive or operation.

My sample code provides most of the info you'd expect.

Notes on Refactoring

I expected you to focus on the repetitive coding aspect of refactoring: When two methods share code, parameterize and put that shared code in a separate function; When two classes share a method, put that shared method in a class that both inherit from or contain.

Some of you found other kinds of refactoring appropriate. Other kinds included:

Times Spent

Here is the information I received on the time you spent on each problem. Clearly, many of the problems took significantly longer than I'd hoped.

Problem 1: 1:30, 1:30, 3:00, 4:00, 4:30, 5:45, 7:00

Problem 2: 2:30, 3:00, 4:15, 4:30, 5:00, 5:00, 5:30, 6:00

Problem 3: 1:00, 2:00, 2:00, 2:30, 2:30, 2:45, 3:00, 3:00-5:00

Problem 4: 1:00, 1:00, 1:00, 1:30, 2:15, 3:15

Total: 11:00, 11:00, 12:00, 12:15, 14:45

Back to Design Patterns (4): Structural Patterns . On to Design Patterns (5): Behavioral Patterns.

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Mon Dec 6 08:52:23 2004.
The source to the document was last modified on Mon Aug 30 08:01:15 2004.
This document may be found at

You may wish to validate this document's HTML ; Valid CSS! ; Check with Bobby

Samuel A. Rebelsky,