From: Jim Weirich Date: 2002-08-28T09:42:50+09:00 Subject: Re: compile time type checking >>>>> "Mark" == Mark Volkmann writes: >> If I read the original poster correctly, he was saying compile time >> checking *helps* a lot; it obviates the need for _some_ unit tests. Mark> That is what I meant.� It seems to me that having Mark> compile-time type checking allows certain coding errors to Mark> be found more quickly and reduces the possibility that users Mark> will experience the equivalent of a Java ClassCastException Mark> or whatever happens in Ruby when you attempt to invoke a Mark> method on an object that doesn't support it. This is a very common fear amoung programmers coming from a statically typed language to a language like Ruby, Python or Smalltalk. Surprisingly (I know I was surprised), the fear does not match the reality. By far, the most common NameError I run across is happens when I send a message to nil, which is the moral equivalent of getting a NullPointerException in Java. Static typing helps neither situation. Personal Testimony ... About 3 years ago I was doing a lot of non-work related programming in Eiffel, a very nice, statically typed object oriented language. I was a strong believer in the advantages of strong typing and the DbC provided by Eiffel. In an email conversation with a friend I mentioned that I needed to get back to programming in a statically type safe language (implying Eiffel). My friend challenged the need for "static type safety" and pushed the idea that statically typed languages were inherently less flexible than a dynamically typed one. I (politely) disagreed and pointed out that Eiffel had a clean type system and didn't limit you the way other statically typed languages did. Since that time I discovered Ruby. In the first six months I was using Ruby, I wrote twice as much software as I did in my entire two years of exploring Eiffel. Ruby is that much more productive (easily). I don't miss the static type safety of Eiffel[1]. It wasn't helping me as much as I thought. But I *do* miss the extreme flexibility of a dynamic language like Ruby whenever I go back to Java or related languages. So, your milage my vary. Give it some time. Get in the habit of driving your design with unit tests. It will come. -- -- Jim Weirich jweirich@one.net http://w3.one.net/~jweirich --------------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas) [1] I do miss the DbC aspect of Eiffel, not so much for program correctness (XP-style test driven design really picks up the slack there), but for the documentation value of explicit contracts.