next up previous
Next: Classification Up: Assignment 2: Object Methods Previous: Assignment 2: Object Methods

Object methods

Chapter 6 of the book explains the syntax for object methods and makes some suggestions about when you might choose one syntax over the other.

  1. Go back over the Deck assignment from last week and consider which methods would be better as object methods. Go ahead and transform them and then test the program to make sure it still works.
  2. Compare the number of lines and number of words in the program before and after this transformation. Which program is more concise? Which program seems easier to read to you? Which program seems like a more natural way to express the computation? Please write a paragraph or two to answer these questions.



Allen Downey
Mon Sep 18 10:06:29 EDT 2000