[plt-scheme] HTDP: Question on 7.4.4

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Sep 13 16:28:14 EDT 2008

You are. My rule tends to be this.

If I use the data definitions

  Shape is one of:
    Circle
    Rectangle
  Circle is ...
  Rectangle is ...

then I design three area functions.

If I use the following, however,

  Shape is one of:
   -- (make-circle ...)
   -- (make-rectangle ...)

I in-line things.


On Sep 11, 2008, at 11:58 PM, Grant Rettke wrote:

> Hi,
>
> In 7.4.4, in each of the cond clauses I've got the question and answer
> "all there". In other words, I didn't break out clear-circle and
> clear-rectangle into separate functions. Since their bodies are tiny,
> I didn't see the point.
>
> One of my friends working through HTDP countered saying "Follow the
> advice of the book; break out complex code into separate functions."
> He didn't say it yet either, but I bet he'll say that it is easier to
> unit test, too.
>
> I feel like conceptually, I don't want to expose those because I
> followed the approach of exposing the clear-shape function "function
> per class approach" versus using a bunch of individual functions, the
> "function per sub-type approach".
>
> Perhaps I am over-thinking this at this point.
>
> Best wishes,
>
> Grant
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.