Python for large projects
jacek.generowicz at cern.ch
Wed Mar 24 14:09:34 CET 2004
Jacek Generowicz <jacek.generowicz at cern.ch> writes:
> Andrew Wilkinson <ajw140NO at SPAMyork.ac.uk> writes:
> > assaf__ at walla.com wrote:
> > I find the lack of static type checking to cause some bugs to hide
> > in my code that in other languages would be found at compile time.
> I feel honour-bound to point out that citing static typing (explicit
> static typing, in particular) as a means of creating more correct
> programs, to be one of the greatest contemporary myths of software
As this statement appears to be causing some interest, I thought I'd
best prestent, in public, a slightly more thoughtful summary of my
thoughts on the subject:
- Static typing systems refuse to compile programs which contain type
- Test suites point out where your program deviates from expected
What is more important to you and/or your clients ? Ask yourself the
- Do your clients give a hoot about whether or not a program is
considered to be type-correct by the type system of programming
language X ?
- Do your clients care whether your program does what it is supposed to
Yes, test suites are incomplete and contain bugs (not by design but
through human fallability), but at least they set out to judge a
program by relevant criteria. The criteria by which static typing
systems judge a program are mostly irrelevant to the goals you are
trying to achieve in writing the program.
Now, I've seen C++ turn the "goal you are trying to achieve" into
"make the compiler accept my program", on more than one
occasion[*]. That only supports my point: static typing systems move
the goalposts in the mind of the development team[+]. But only in the
mind of the development team: the customer still wants a program that
does what it's supposed to do.
Getting a 95% correct solution to your task, is better than getting a
100% correct solution to an orthogonal task. Passing the tests in a
95% (or 90% or 80%) complete/correct test suite, gets you closer to
solving your clients' problems than does passing 100% of the
requirements of a static type system.
For those last few percent, neither test suites, not static typing
system can offer you any guarantee.
[*] It compiles! Quick, ship it before it breaks! :-)
[+] C++ does have a special talent for this sort of thing, not only
via its type system, but because of its design as a whole.
More information about the Python-list