Express What, not How.
Christian Szegedy
szegedy at nospam.or.uni-bonn.de
Wed Oct 15 11:59:33 EDT 2003
Raffael Cavallaro wrote:
>
> 2. If it is necessary to show, at that _particular_ source location,
> _how_ a piece of functionality is provided. If the reader doesn't need
> to know _how_ things are implemented in that _particular_ source
> location, we should use a descriptively named function or macro instead.
>
> I find that many programmers overestimate the "uniqueness" of their
> anonymous functions. They tend to repeat the same anonymous function
> idiom in many places. Rather than come up with a descriptive name for
> _what_ they are doing, they clutter a higher level abstraction with low
> level details about _how_ they are doing it. These should be recast as
> descriptively named functions or macros.
>
In functional languages, a lot of higher order functions are used for
iterating over some container datastructure. E.g. map,iter,foldl,zip,...
A lambda expression parameter of such functions plays the
same role as a body of a "while" or "for" loop in C.
Do you think that your criterions should be applied to blocks
of codes in C also?
More information about the Python-list
mailing list