Clarity vs. code reuse/generality

kj at
Thu Jul 9 03:20:10 CEST 2009

In <mailman.2671.1246866295.8015.python-list at> Martin Vilcans <martin at> writes:

>On Fri, Jul 3, 2009 at 4:05 PM, kj< at> wrote:
>> I'm will be teaching a programming class to novices, and I've run
>> into a clear conflict between two of the principles I'd like to
>> teach: code clarity vs. code reuse. =A0I'd love your opinion about
>> it.

>In general, code clarity is more important than reusability.
>Unfortunately, many novice programmers have the opposite impression. I
>have seen too much convoluted code written by beginners who try to
>make the code generic. Writing simple, clear, to-the-point code is
>hard enough as it is, even when not aiming at making it reusable.

>If in the future you see an opportunity to reuse the code, then and
>only then is the time to make it generic.

>YAGNI is a wonderful principle.



More information about the Python-list mailing list