[plt-scheme] Re: Novice needs help writing function

From: Matt Jadud (jadudm at gmail.com)
Date: Sun Dec 30 21:13:13 EST 2007

Hi Dave,

> Third, while sifting layers of complexity, it might also try to
> identify certain types of recursive problem-solving techniques and
> link them to generic problem types. For example, I downloaded a paper
... snip ...
> requiring a "branched" approach, like Fibonacci, for example.

The design recipe works quite well for programs written in many
languages, recursive or not. Before you begin, you must understand
what a given function will consume (implying you understand the data
you are operating on), what it will return, and what the purpose of
the function is. You must then write tests (examples) for how you
expect your function to operate; they should all fail until your code
is correct. You should then be able to define your function; if it is
too complex to capture simply, you probably need helper functions to
make the problem more tractable.

Whether you are operating on numbers, records, or self-referential
structures shouldn't make this process necessarily more complex.
Indeed, the process should remain consistent across all of these types
of data.

> "Sorry, after looking over the code, I think you should send us the
> WHOLE design before I make any other comment any more."

I think Matthias is suggesting that you may not have worked through
the entire design recipe. The point of the recipe is to provide
(a/the) problem-solving process you're seeking; if you aren't actually
working through the process of writing contracts, purpose statements,
and examples before writing your code, you're failing the exercise.
Or, if you prefer, you're hacking, not designing a solution to the
problem.

Design is a process. The design recipe makes that process visible. If
you don't externalize that process, we can only comment on the results
of your hacking, not on the process.

Cheers,
Matt


Posted on the users mailing list.