Tuesday, March 31, 2009

Problem Set 10 is now available; other things

Homework 10 is now on the web site.

Also, I've committed the example files from last night's lecture to the example repository.

Last, if you are looking for a tool to make nicer class diagrams, you might want to check out UMLet. It can run either as a standalone application or as an Eclipse plug-in. I played with the standalone version for about 5 minutes and it seems ok. Kindly note that the handwritten class diagrams are fine, and I don't want you to waste a lot of time making them prettier. But if you feel the lack of a tool, here's one to check out. Thanks to Denis and Chander for the tip.

--Prof. Wand

Thursday, March 26, 2009

Problem set 8 codewalks stats

full grade: 90, max grade: 80, min grade:70, avg grade:74, mean grade: 73

Tuesday, March 24, 2009

Problem Set 9 is now available

...in the usual place.

--Prof. Wand

Thursday, March 19, 2009

Problem set 7 codewalks stats

full grade:70, max grade:70, min grade:56, avg grade:65.5, mean grade:67

Wednesday, March 18, 2009

Readings for Monday 3/23

For Monday's lecture, please read Part IV (Chapters 23-28). This is complicated stuff, so it may take us more than one lecture to cover it, but you should read as much of it as you can for Monday.

--Prof. Wand

Sunday, March 15, 2009

Readings for Monday

We covered parts I and II of HtDC last week, so you should read Part III and Intermezzo 3 for this week's lecture.

--Prof. Wand

Thursday, March 12, 2009

Problem set 6 codewalks stats

full grade: 64, max grade : 52, min grade: 37, avg grade: 44.25, median grade: 44

Tuesday, March 10, 2009

Updates to Lecture 7 examples

There were a few points that I missed during last night's lecture:

1. Every method has an implicit argument called this . This is the argument on which the method "works" and corresponds to the argument on which we are using the structure strategy. Recall how I wrote

(define (foo this)
[(empty? this) ...]

Your purpose statement will almost always contain the word "this". That's a clue!

2. When you reference a field foo of an object, you should always say this.foo, not just foo. This is enforced in ProfessorJ/Beginner, but not in ProfessorJ/Intermediate. My examples violated this rule. So I should have said things like:

boolean test1 = check this.book1.listing() expect "Mitch: EOPL";

rather than

boolean test1 = check book1.listing() expect "Mitch: EOPL";

3. I was not happy with the method availableHelper :

boolean availableHelper (String title, int quantity) {
// is this book available in this quantity?
return ((this.ncopies >= quantity) && this.title.equals(title));

because (a) it violates the rule of 1-task/1-function and (b) it seems awfully artificial: it's not an obvious method for Book.

Here's a better solution: add to Book two methods

boolean titleEquals(String s) {
// does the title of this book equal s?
return this.title.equals(s);

boolean ncopiesGreaterThan(int n) {
// are at least n copies of this book on hand?
return this.ncopies >= n;

and in NeLOB redefine availableTitle to:

boolean availableTitle(String title, int n) {
// ... this.first ... this.rest.availableTitle(title, n) ...
if (this.first.titleEquals(title) && this.first.ncopiesGreaterThan(n))
{return true;}
{return this.rest.availableTitle(title,n);}

[Finger exercise: Modify the method so that if the title is found, but there aren't enough copies, the method returns false immediately, rather than recurring through the rest of the list.]

Anyhow, both these changes are in book2.java, now in the examples/Lecture 7 repository.

--Prof. Wand

Problem Set 7 now available

PS7 is now up on the web site. Please make the class diagrams using whatever method is effective for you. We'd prefer to get something we can project, but if that turns out to be hard, just do it on paper.

Wednesday, March 4, 2009

Tutorial/Drill Club/Questions on Thursday

Hi everyone,

On Thursday at 18:00 @ WVH 164, I will hold a multi-purpose office hours session.

See you then.


Tuesday, March 3, 2009

Collection of Templates

Thanks to Christos, we now have the collection of official templates posted online. This is also available from the navigation column on the course home page.

--Prof. Wand