Clarity vs. code reuse/generality

kj no.email at please.post
Wed Jul 8 21:21:22 EDT 2009


In <fMKdnf0dlOXTcMzXnZ2dnUVZ_t2dnZ2d at pdx.net> Scott David Daniels <Scott.Daniels at Acm.Org> writes:

>First, a quote which took me a bit to find:
>     Thomas William Körner paraphrasing Polya and Svego
>     in A Companion to Analysis:
>         Recalling that 'once is a trick, twice is a method,
>         thrice is a theorem, and four times a theory,' we
>         seek to codify this insight.

Good stuff.

>Let us apply this insight:
>     Suppose in writing code, we pretty much go with that.
>A method is something you notice, a theorem is a function, and
>a theory is a generalized function.

>Even though we like DRY ("don't repeat yourself") as a maxim, let
>it go the first time and wait until you see the pattern (a possible
>function).  I'd go with a function first, a pair of functions, and
>only then look to abstracting the function.

Thanks!

kynn



More information about the Python-list mailing list