[racket] Top-down design, wish-lists, and testing

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Mon Nov 22 09:13:31 EST 2010

Interesting ideas.  The closest thing Racket currently supports is the "..." literal, which acts like an expression for syntax-checking and compilation purposes, but throws an exception when evaluated; it allows you to write either stub functions or stub sections of a larger function (e.g. one or more cases of a cond).

But I see some merit to the idea of an explicit language construct that says "I'm going to want this function, but I haven't gotten around to writing it yet."  Sorta like a C prototype :-)

Like a C prototype, I would encourage any such construct to include whatever contract information is ordinarily specified in code.  If we don't have define/contract or something similar, it should at least specify the number of parameters, so this can be checked; once we DO have checked contracts in teaching languages, stubs should get them too.

Until such a language construct is decided upon and implemented, I would recommend writing stub functions by tweaking the steps of the design recipe only slightly: write a contract, skip the test cases, write a function header and a "..." body.  Before you come back to write a real body, you have to write real test cases.

Stephen Bloch
sbloch at adelphi.edu

Posted on the users mailing list.