> Che, from the analogies you made, it looks like you might not have very
> clear what Unit Testing is for.
> 
> True, UT is a way to automate tests that otherwise you should do
> manually (as per your analogy), but the test you automate with UT are
> not a "one off" thing (as it is processing the data needed to publish a
> paper): depending on the coding philosophy you follow, you might run UT
> as often as every couple of hours of coding (as it is in certain agile
> programming techniques).
> 
> UT is there to give you a tool to prevent regression *when/if you modify
> or refactor your code* (which is the norm if you are a professional
> programmer), and its advantages grow exponentially with the increase of
> complexity of the code and the increase of number of developers working
> on the project (it is very easy to break someone's else code... there is
> a reason for which "blame" - http://blame.sourceforge.net/ - is called
> that way!).
> 
> If you are an hobbyist programmer busy on a simple one-off small app,
> you may skip UT altogether, manually inspect the behaviour of your
> program, and never regret it. 
> 
> But if you are writing an e-commerce application that will organise
> transaction for millions of euros of revenue monthly, UT is probably the
> very first code you will want to commit to your repo.

Mac, I found this an excellent brief overview of UT and your points all
seem very strong to me.  Thanks very much.  I admit I didn't really know
anything about the topic and was mentioning my feelings on the matter
partly to elicit enlightening responses like this (maybe because I was feeling 
like I was being irresponsible with my own project by not learning UT 
and running tests).  

I am in the "hobbyist programmer busy on a simple one-off small app"
camp ("simple" is relative...though it is clearly nothing like a big 
e-commerce application!), so I feel OK with foregoing getting into UT 
for now.  If things get more complex and I at some point have actual users
instead of the large number of vapor users I have now (:D) I may buckle
down and learn it.

> PS: I did not comment on the analogy with evolution, because did not get
> the parallelism you were trying to draw. Care to explain?

I just meant that evolution by natural selection works on a "good enough"
principle:  that successful species evolve not toward the most perfected
forms but the forms that are simply good enough to allow them to pass
on enough of their genes to stay in the game.  And sometimes "good
enough" is good enough--that is, you shouldn't waste your time doing
things perfectly properly. In my case, I thought doing things perfectly 
properly would be learning all about UT and bringing that into my 
development process--but manual inspection would be "good enough".
(But now I see that really it *is* proper to skip UT if the project doesn't 
warrant it).

Thanks,
Che
                                          
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to