[plt-scheme] HTDP: Testing programs

From: Jos Koot (jos.koot at telefonica.net)
Date: Wed Aug 27 18:03:26 EDT 2008

----- Original Message ----- 
From: "Matthias Felleisen" <matthias at ccs.neu.edu>
To: "Jos Koot" <jos.koot at telefonica.net>
Cc: "Shriram Krishnamurthi" <sk at cs.brown.edu>; "PLT List" 
<plt-scheme at list.cs.brown.edu>
Sent: Wednesday, August 27, 2008 11:28 PM
Subject: Re: [plt-scheme] HTDP: Testing programs


>
> In principle, I agree with you. Sadly I suspect it's beyond  beginners. --  
> Matthias

That's probably true in the present situation. Things could be made 
different, though, when requiring some mathematical background before 
starting lessons in programming. (I assume that is the case, presently) 
Then, if the mathematical background would indeed include some discussions 
about units (which is by no means too complicated), I assume it would not be 
beyond beginners. However, such a perspective would require cooperation 
between a number of disciplines (Mathematics, Physics and Programming)

I have some experience in teaching mathematics. My experience is that adding 
some discussion about units is not an extra burden upon the student. On the 
contrary, it may clarify a lot. (In fact the extra discussion should not be 
needed, for units are/should already be discussed at primary schools (I hope 
that's still the case, though sometimes I meet students that make me 
wonder))
Jos

>
>
>
>
>
> On Aug 27, 2008, at 4:51 PM, Jos Koot wrote:
>
>>
>> ----- Original Message ----- From: "Matthias Felleisen" 
>> <matthias at ccs.neu.edu>
>> To: "Shriram Krishnamurthi" <sk at cs.brown.edu>
>> Cc: "PLT List" <plt-scheme at list.cs.brown.edu>
>> Sent: Wednesday, August 27, 2008 3:18 PM
>> Subject: Re: [plt-scheme] HTDP: Testing programs
>>
>>
>>>
>>> Shriram's saying that the design recipe demands the creation of 
>>> examples *before* you create the function. The idea is that this 
>>> scales up to larger development efforts, too.
>>>
>>> In principle, a design looks like this:
>>>
>>> ;; f->c : Number -> Number
>>> ;; convert a fahrenheit temperature to a celsius temperature
>>
>> Nitting a little bit I say that in most systems of dimensional  units a 
>> temperature is not a number. It is a number times a unit of  temperature 
>> relative to an offset temperature.
>> f -> c : Real Number -> Real Number
>> convert real number f to real number c such that f degrees  Farhenheit = 
>> c degrees Celcius,
>> where "=" is exact when f is exact and "=" is approximative when f  is 
>> inexact.
>>
>> I say this because I am a little bit concerned about the many  examples 
>> in books about mathematics and programming that do not  consistently 
>> apply the theory of dimensions.
>> Imho it is wrong to say that the surface of a square with side 10  is 
>> 100. This can only be correct in a system of units in which  lengths have 
>> no dimensional unit, but I never have seen such a  system (on the 
>> contrary, the *simplest* system of units I know of,  has one dimensional 
>> unit, namely for length)
>>
>> This is important for progarammers too. We may *represent* a  temperature 
>> by a number with respect to a chosen scale of units but  while 
>> programming we should be aware of the fact that the  representation is 
>> not the same as the represented quantity.
>> Jos
>>
>>
>>>
>>> (check-expect (f->c 32) 0)
>>> (check-expect (f->c 212) 100)
>>>
>>> (define (f->c f-temp)
>>>  (cond
>>>    [(= f-temp 32) 0]
>>>    [(= f-temp 212) 100]
>>>    [else f-temp]))
>>>
>>> ;; ---
>>>
>>> Over the years, HtDP and drscheme have gotten a bit out of hand.  One 
>>> day we'll catch up. -- Matthias
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Aug 27, 2008, at 7:19 AM, Shriram Krishnamurthi wrote:
>>>
>>>> The intent is that you write test cases *before* you
>>>> write your functions.  If you had done this, and your
>>>> test cases covered your program, DrScheme would
>>>> not complain at you.  Bad boy! (-:
>>>>
>>>> Shriram
>>>>
>>>> On Tue, Aug 26, 2008 at 11:39 PM, Grant Rettke <grettke at acm.org> 
>>>> wrote:
>>>>> Hi folks,
>>>>>
>>>>> In HTDP beginner language on problem 2.2.1, when I evaluate it,
>>>>> DrScheme complains that "This program should be tested".
>>>>>
>>>>> is the intention that students start testing immediately, or we ill
>>>>> add tests later on?
>>>>>
>>>>> I used check-expect for now.
>>>>>
>>>>> Best wishes,
>>>>>
>>>>> Grant
>>>>> _________________________________________________
>>>>>  For list-related administrative tasks:
>>>>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>>>
>>>> _________________________________________________
>>>>   For list-related administrative tasks:
>>>>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>
>>> _________________________________________________
>>>  For list-related administrative tasks:
>>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
> 



Posted on the users mailing list.