Python for large projects

Jacek Generowicz jacek.generowicz at cern.ch
Wed Mar 24 07:03:52 EST 2004


Matthias <no at spam.pls> writes:

> Ville Vainio <ville at spammers.com> writes:
> 
> > >>>>> "Jacek" == Jacek Trzmiel <sc0rp at hot.pl> writes:
> > 
> >     Jacek> Jacek Generowicz wrote:
> >     >> ... and one thing that makes unit testing very difficult, is
> >     >> static typing ...
> > 
> >     Jacek> Care to provide some examples to back this opinion up?

Your supercite references to "Jacek" are rather ambiguous, in this
case (unlikely though it may seem, in general :-)

> > Programming is just a lot of work in statically typed languages, so
> > you need to work very hard to get even the basic functionality
> > working. You might not have energy/time/money to make proper unit
> > tests after/during the development.

"After", is far too late, in my opinion. It's a bit like suggesting to
a static-typing-for-safety fan, that he should only run his program
through the compiler _after_ he has finished developing. I find that
one of the greatest benefits that test suites afford, is giving you
the confidence to change your program, in the knowledge that things
you break will become apparent immediately. Before I started writing
test suites _during_ development, I was always scared that any change
I made would break things in ways I wouldn't notice. Consequently I
used to spend a huge effort on pseudorandomly trying to find ways in
which my modifications could have broken other parts of my
system. With a test suite growing alongside your application, a high
degree of confidence is a mere button press away. It has made me a
much more productive and happy programmer. (I have, of course, no
_scientific_ evidence for this, but my perception of it being so is
overwhelming.)

> Aren't unit tests used to _save_ energy/time/money?

Yup. And they _do_.

> If so, why should this be different w.r.t. typing?

I'm not sure that I understand your question.

w.r.t _static_ typing ?

I think that Ville's point is that static typing gets in your way so
much when you are developing the functionality of your program, that
you are unlikely to make the added investment of writing test suites
_as_ you develop: they seem to be yet another irrelevant annoyance. I
agree, at the very beginning of any project, writing tests looks like
a drag, and it looks premature. I am tempted to agree that right at
the _very_ beginning, it is premature. But shortly thereafter you
should start writing your tests ... and shortly after that they start
paying handsom dividends. (All my very personal and subjective
experience, of course.)



More information about the Python-list mailing list