[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: examination of C hackers (was Conway's Game of Life (cellular automata))




1. See my Web page about programs that work (in a different style). 

2. What matters is NOT that a program works. We have learned this over the
   past N years. What matters is that you write it in a style that others
   can understand, too. Ideally, we should all be trained in these styles. 

3. HtDP design recipes offer choices, too. You can write one and the same
   program based on structural recursion or generative recursion, using
   acccumulators or higher-order iterators. The key is that you have a
   language in which you can convey the key properties of your design. 

   You can write:

   ;; gcd : Num Num -> Num 
   ;; generative recursion (Euclid's idea) 

   or 

   ;; gcd : Num Num -> Num 
   ;; structural recursion

   or 

   (define (traversal start-node graph)
   ... (local (; accumulator seen : (listof Node), the list of nodes visited 
	       ; while traversing graph from start-node to current-node
	       [define (traversal current-node seen) ...]) ...)

   Then the next guy can come along and understand your code.

4. And all this comes with a purpose statements, a test suite, a data
   definition, etc, etc. 

If you haven't learned that from a course on programming, then all you have
learned is how to compose syntactically correct sentences in your language
that work on some haphazardly chosen test cases. 

Don't test them on features and "it works." Test the general context, too. 
It matters. 

-- Matthias