[Tutor] I don't get it

Erik Price erikprice@mac.com
Fri, 20 Sep 2002 12:36:14 -0400


On Friday, September 20, 2002, at 11:03  AM, Sean 'Shaleh' Perry wrote:

> On Friday 20 September 2002 05:15, Erik Price wrote:
>> On Friday, September 20, 2002, at 01:35  AM, Danny Yoo wrote:
>>> However, I think your programs are also very monolithic.  My opinion 
>>> is
>>> that your programming will become better if you define more utility
>>> functions.
>>
>> if __name__ == '__main__':
>>
>> Was really a lightbulb-turner-onner for me.
>>
>
> Indeed.  It leads to unit testing and testing is not possible if you 
> have all
> of your code in one, big jumble.  I find that forcing myself to write 
> tests
> also forces me to design my code better.

I have heard of unit-testing.  But I'm not sure exactly what it is.  My 
best guess is that it's when you provide sample data in the "if 
__name__ == '__main__' " block so that you can execute this class 
individually to make sure it works.

But I don't know the methodology of unit testing.

(OT question: Does anyone know, is the Java version of "if __name__ == 
'__main__' " a simple matter of using the main() method?)



Erik





--
Erik Price                                   (zombies roam)

email: erikprice@mac.com
jabber: erikprice@jabber.org