Ian Bicking: Because Unanswered Problems Are Always Hard. This really is the single best article pointing out the advantages of dynamic typing that I've ever seen. Quotations:
"Back to reliability: one way to decrease bugs is testing, but another way is to decrease the amount of code. Code deleted is code debugged. Static typing can decrease the number of bugs, but decreasing the amount of code is a much, much more effective way to decrease bugs. If you can have both -- short code and static typing -- then more power to you. I just haven't seen it myself."
"Now forgotten, at one time there were languages that were both weakly typed and dynamically typed; things like assembly and Forth. Ouch. There were two paths from there: one to make runtime values intrinsically typed (Lisp), and one to make the source code intrinsically typed (C). But just because assembly sucked a lot doesn't mean all languages afterward must approach the problem in terms of its suckage. And just because there was that split, doesn't mean joining both worlds (a language with both intrinsically typed values and source, i.e. Java) is better."
"Static type defenders complain about the combinatorial type interactions in dynamically typed languages -- how can you test all the code paths, given all the possible types? But their languages lead to combinatorial code, which is far worse: for many classes of hard problems, they can't solve them once, they have to solve them everytime they are encountered. Ouch."
This has gone around the Python blogsphere like wildfire, naturally. I'm posting here for the Java types who visit from time to time.
Of course, words are cheap, even words as eloquent as Ian's. I know that dynamic languages are just as reliable and much more productive that statically typed languages are through real experience. If you've only tried one approach, give the other a go. You'll learn.
If you don't know what Ian's banging on about, read How Python's Datatypes Compare to Other Programming Languages. If that doesn't make sense, you're either not a programmer, or shouldn't be. ;-)
Posted to Python by Simon Brunning at December 15, 2004 02:22 PMThis is great. I'm a Java dude, but I like to read about the advantages to be had in Python. One day I may even do something about it.
Posted by: David Pinn on December 15, 2004 06:44 PMOf course, it buggers you if your productivity is measured in lines of code (LOC). Not that anyone who reads this blog would work in such an organisation ;-)
Posted by: Andy Todd on December 15, 2004 10:26 PMIn OCaml (and other MLs), which supports type inference, you do *not* need to declare anything, so your argument relating to code size obviously does not apply.
Also with polymorphism you avoid needless repetition to get around the type system.
(On the other hand, the standard library still contatins a lot of duplication. This will hopefully change in the future.)
Which approach (static vs. dynamic) is more productive depends on the application, I would presume. If you have something simple, go ahead dynamic. But if you have a long-running calculation which needs a lot of time to test, you'll want to know right away if you made an error.
Posted by: Andre Kloss on December 16, 2004 02:11 PMI was going to mention OCaml, but Andre beat me to it...
Posted by: awwaiid on December 17, 2004 05:31 AM