Incoherence after the point
One of my readers sent me a link to this article on "duck typing" (i.e., what Smalltalkers have called dynamic typing for eons now). Here's the part I found incoherent:
First of all, let's get a frequently asked question out of the way: if two interfaces have the same methods, are they semantically equivalent? Isn't there a risk to pass an object that is totally wrong for this method, yet will work because it responds to the right methods?
I don't have a clear answer to that, but my experience is that such a thing is very unlikely. This kind of argument is a bit similar to the fear we all felt in the beginning of Java when we realized that containers are not typed: ClassCastExceptions end up being much more rare than we all thought.
Duck Typing is a big time saver when you write code, but is it worth it? Don't you pay this ease of development much later in the development cycle? Isn't there a risk that you might be shipping code that is broken?
The answer is obviously yes.
So the sorts of errors the author fears are virtually non-existant, but they introduce a huge risk of shipping broken code. Excuse me? Is it just me, or is the author arguing with himself here?
One of the things I really like about this mode of argument is that testing isn't sufficient - we need something stronger (enter declarative typing). If that's the case, why do people writing in C++, Java, or C# even need to test? Doesn't the typing obviate the need for it? The point is, you need to test anyway. If a given paradigm - dynamic typing in this case - increases productivity - and if declarative typing doesn't obviate the need for testing (it doesn't) - then what does the typing buy you? Better arithmetic performance, mostly. That's useful for a small range of applications (and, for most of those, we can use a high level language like Smalltalk and mixin lower level languages for the performance critical sections. Plenty of our customers do just that.
The author comes up with a contrived example to show that declarative typing will save you from a potential runtime nightmare. I say contrived because I've written code using the kind of API he talks about many, many times. Want to know how many times I've walked into the minefield he fears? It's a small number, except for the larger values of zero.
The best part of the whole thing is the comments, where some of the responders claim that refactoring tools are "impossible" in languages like Smalltalk. Times like this I wonder how many people realize that all the cool stuff that people think came from Java - like refactoring support and unit testing - were invented in Smalltalk more than a decade ago.
I swear, this entire industry actively engages in amnesia...

Comments
In other words...
[Hmmm...] April 24, 2005 12:20:57.644
Fear is the mark of lack of understanding. Amen.
[Sch] April 24, 2005 12:59:44.724
You can add garbage collection to the Java invention stuff ... this is pretty sad but many people have a computer history only starting in 1995/96.
Don't tell anyone, but in my working environment where Java/C#/.Net is king, Smalltalk is my secret weapon to be efficient and clever in OOP. :)
I will never thank enough the professor that used to teach OOP in Smalltalk. Sadly, the year after, he gave up its course to the Java lobby (mainly students).
[Norfy] April 25, 2005 8:33:20.590
A colleague who bemoans my Smalltalk evangelising, implemented dynamic message sending using reflection to solve his problems with static typing...
[Mark] April 25, 2005 20:30:31.442
What's that greenspun? quote about lisp? Maybe the same could be applied to OO languages.. Any sufficiently complicated C++, Java, or C# program contains an ad hoc informally-specified bug-ridden slow implementation of half of Smalltalk? heh.