From: Anders Bengtsson Date: 2002-08-28T05:12:53+09:00 Subject: RE: compile time type checking Volkmann, Mark wrote: > > In the same way, I don't often see the wrong kind of object being used > > in Ruby. However, to ensure that, I have to exercise the various paths > > through the code, so I rely on unit tests to give me the confidence > > that my code is reasonable. > > Would you agree that with Ruby you have to write more unit tests than you do > in Java? You need to test that the types of parameters being passed to every > method are what was expected. It seems that this would cut into the > productivity gains in writing the actual code when compared to Java. You rarely want to write unit tests that test the type directly, like "object.kind_of?(Type)". Instead, if the object actually has the methods required for it to work (which the other unit tests already show), then why limit your code to just one type? For example, instead of requireing an argument of type Array, you often will do with any object that responds to []. Write the unit tests so that they show this real requirement, instead of requireing a specific type. > Even better than compile-time type checking is the fact that my IDE, IDEA, > flags parameter type issues before I even compile. I wish there was a Ruby > IDE that could do that. I would love a Ruby editor that could do "Find Usages" and all that other stuff. > I really want to be convinced that this whole type checking thing is a > non-issue for Ruby, but I'm not quite there yet. Ah, just wait for it. :) /Anders -- A n d e r s B e n g t s s o n | ndrsbngtssn@yahoo.se Stockholm, Sweden | _____________________________________________________ Gratis e-mail resten av livet p� www.yahoo.se/mail Busenkelt!