Could Python supplant Java?

Steve Austin joeking at merseymail.com
Wed Aug 21 11:14:33 EDT 2002


> [FISH]
[snipped...]
> But what if you write your tests first, before you even begin writing
> code?


And that makes a difference, because...?  :-)


[snipped...]
> Actually, unittest.py does have a unit test.  Neat, huh?
> 
> The tests initially fail--because you haven't written any code yet.  Then
> you write the code. Some of the tests pass. Others still fail. Maybe you
> discover you need to modify the tests.  More of them now pass.  But you
> still need to modify the code.  The tests and the code evolve together.

Other languages have similar test suites, including Java.

Code shouldn't 'evolve'.  Your design 'evolves'.  By the time
you come to code your software you should be just implementing
the design.

You do design your software before you sit down to write...
Right?  ;-)


> Of course, if you take a linear approach, where you have this fixed
> notion
> of what's first and what's last and you march from one to the other
> without
> ever turning back, then you might not allow yourself to be so flexible.

By 'linear approach' you mean I work out in advance how I
am going to do things, rather than make it up as I go 
along, as my mood suits me?  :-)

To return to the original topic, Python vs. Java - the 
point is mute.  They are two separate languages for
separate purposes.  It's not a case of one versus the
other, but rather a case of using the right tool for
the job.

And as for static vs dynamic data types.  I do find the 
attitude of *some* Python programmers on the newsgroup
a little disappointing.  They seem to advocate throwing
the code together and then trapping all the errors
by devloping test suites.  Dynamic and static types have
their place - but one of the nice things about static
datatypes is that it provides just that little but extra
checking that the compiler can do for you, if you provide 
it with such information like what type of data you
expect to be holding in each variable.

Sometimes such checking is overkill - some languages,
like Javascript for example, don't bother with it because
they are targetted at writing code which is likely to
be compact and simplistic.  Other times such checking 
can be useful - it just stops you from spending hours
debugging after you've shot yourself in the foot because
a variable on the ten-million'th line of code you 
thought had an integer value in it actually holds a 
string in some limited cases.

You pays y'money and y'takes y'pick!  :-)


-FISH-   ><>




--
-FISH-   ><>

<joeking at merseymail.com>

--------------------------------------------------------------------
Get your own FREE local e-mail address at http://www.merseymail.com/




More information about the Python-list mailing list