Patterns of Human Error - my presentation at the DC ACM

bearophile bearophileHUGS at lycos.com
Wed May 11 13:21:07 PDT 2011


Kagamin:

> I rather meant the assertion that in languages with duck type system unittesting eliminates to some degree the need for strong type system.

I like both dynamically typed languages and statically typed ones, both have advantages and disadvantages. The "dynamic" C# keyword and other things in other new languages tells me that we're going to languages that try to combine the advantages of both. I sometimes prefer dynamic typing to build prototypes, but sometimes a _flexible_ static typing (like Haskell one) is useful for prototypes too.

Unit testing is able to replace some of the tests done by a static type system. On the other hand a type system is able to test _all_ code paths, while the unittests cover only the paths exercised in the tests. So in the end I use about an equal number of unit tests in D and Python. And beside normal unit testing there are other forms of testing, like QuickCheck (http://en.wikipedia.org/wiki/QuickCheck ).

Very large Python programs (like Zope) implement some kind of interfaces (and recent versions of Python have added ABC, Abstract Base Classes), some some help from a bit more structured type system is useful even in dynamically typed languages when the programs become large.

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list