Python from Wise Guy's Viewpoint
Pascal Costanza
costanza at web.de
Fri Oct 24 17:07:58 EDT 2003
Marshall Spight wrote:
> "Pascal Costanza" <costanza at web.de> wrote in message news:bn8nhq$l04$1 at f1node01.rhrz.uni-bonn.de...
>
>>In a statically typed language, when I write a test case that calls a
>>specific method, I need to write at least one class that implements at
>>least that method, otherwise the code won't compile.
>>
>>In a dynamically typed language I can concentrate on writing the test
>>cases first and don't need to write dummy code to make some arbitrary
>>static checker happy.
>
>
> This is a non-issue. In both cases, you need the implementing code
> if you want to be able to run the testcase, and you don't need the
> implementing code if you don't.
No, in a dynamically typed language, I don't need the implementation to
be able to run the testcase.
Among other things:
- the test cases can serve as a kind of todo-list. I run the testsuite,
and it gives me an exception. This shows what portion of code I can work
on next.
- when a test case gives me an exception, I can inspect the runtime
environment and analyze how far the test case got, what it already
successfully did, what is missing, and maybe even why it is missing.
With a statically typed language, I wouldn't be able to get that far.
Furthermore, when I am still in the exceptional situation, I can change
variable settings, define a function on the fly, return some value from
a yet undefined method by hand to see if it can make the rest of the
code work, and so on.
Pascal
--
Pascal Costanza University of Bonn
mailto:costanza at web.de Institute of Computer Science III
http://www.pascalcostanza.de Römerstr. 164, D-53117 Bonn (Germany)
More information about the Python-list
mailing list