Express What, not How.

Raffael Cavallaro raffaelcavallaro at junk.mail.me.not.mac.com
Tue Oct 14 18:09:44 EDT 2003


In article <bmh6p4$7b2$1 at terabinaries.xmission.com>,
 Thant Tessman <thant at acm.org> wrote:

> A programmer accustomed to the 
> functional style finds the need in non-FP languages to name every 
> function analogously awkward.

No one is talking about need, but about clarity of exposition.

It is perfectly possible to program functionally in lisp, as I'm sure 
you know. It just makes code less readable to use _anonymous_ functions. 
Code is no less functional when the functions are named.

A theme of this whole thread is the difference between writing _what_ 
something does, and _how_ it does it. The higher up the ladder of 
abstraction we go, the more we want to express _what_ is being done. We 
leave the _how_ defined elsewhere, to be consulted only as needed.

Anonymous functions force the _how_ to be interleaved with the _what_, 
breaking up the clarity of the _what_. Named functions (and macros) 
allow the high level abstractions to be expressed in terms of _what_ is 
happening, without unnecessary reference to _how_.

Anonymous functions force the reader to deal with _how_ precisely 
because there is no descriptive name that expresses _what_ the funtion 
does. This is an inappropriate conflation of two distinct purposes, that 
can and should be separated in source code.




More information about the Python-list mailing list