From: "Volkmann, Mark" Date: 2002-08-28T04:35:31+09:00 Subject: RE: compile time type checking This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C24E00.AAB6ABE0 Content-Type: text/plain; charset="iso-8859-1" > -----Original Message----- > From: Dave Thomas [mailto:Dave@PragmaticProgrammer.com] > Sent: Tuesday, August 27, 2002 2:12 PM > To: ruby-talk@ruby-lang.org > Subject: Re: compile time type checking > > > "Volkmann, Mark" writes: > > > I'm curious how some of you that have written real > applications in Ruby have > > dealt with this. Don't you have problems where an > application crashes on a > > user because the wrong type of object gets passed to a > method and it tries > > to invoke a method of the object that it doesn't have? > ... > > I love Ruby syntax, but this issue may be one that keeps > many people using > > Java instead. > > But Java has run-time type checking as well. Consider an average > running Java program. How many objects are extant? 1,000? 2,000? How > many variables do you have? 20? 30? So, where are all the other > objects? In collections. And how do you get to them? By casting at > every access. The type gets discovered at run time. > > How many class cast exceptions do you see in Java? In reality, not > many. That matches my experience. I don't see ClassCastExceptions all that often. However, I think I would if it wasn't for compile-time type checking. > 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. 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 really want to be convinced that this whole type checking thing is a non-issue for Ruby, but I'm not quite there yet. *********************************************************************************** WARNING: All e-mail sent to and from this address will be received or otherwise recorded by the A.G. Edwards corporate e-mail system and is subject to archival, monitoring or review by, and/or disclosure to, someone other than the recipient. ************************************************************************************ ------_=_NextPart_001_01C24E00.AAB6ABE0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: compile time type checking

> -----Original Message-----
> From: Dave Thomas [mailto:Dave@PragmaticProgrammer.com]
> Sent: Tuesday, August 27, 2002 2:12 PM
> To: ruby-talk@ruby-lang.org
> Subject: Re: compile time type checking
>
>
> "Volkmann, Mark" <Mark.Volkmann@AGEDWA= RDS.com> writes:
>
> > I'm curious how some of you that have written = real
> applications in Ruby have
> > dealt with this. Don't you have problems where= an
> application crashes on a
> > user because the wrong type of object gets pas= sed to a
> method and it tries
> > to invoke a method of the object that it doesn= 't have?
> ...
> > I love Ruby syntax, but this issue may be one = that keeps
> many people using
> > Java instead.
>
> But Java has run-time type checking as well. Consid= er an average
> running Java program. How many objects are extant? = 1,000? 2,000? How
> many variables do you have? 20? 30?  So, where= are all the other
> objects? In collections. And how do you get to them= ? By casting at
> every access. The type gets discovered at run time.=
>
> How many class cast exceptions do you see in Java? = In reality, not
> many.

That matches my experience. I don't see ClassCastExceptio= ns all that often. However, I think I would if it wasn't for compile-time t= ype checking.

> 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 exercis= e the various paths
> through the code, so I rely on unit tests to give m= e the confidence
> that my code is reasonable.

Would you agree that with Ruby you have to write more uni= t 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 woul= d cut into the productivity gains in writing the actual code when compared = to Java.

Even better than compile-time type checking is the fact t= hat my IDE, IDEA, flags parameter type issues before I even compile. I wish= there was a Ruby IDE that could do that.

I really want to be convinced that this whole type checki= ng thing is a non-issue for Ruby, but I'm not quite there yet.



***************************************************************************= ********
WARNING: All e-mail sent to and from this address will be received or
otherwise recorded by the A.G. Edwards corporate e-mail system and is
subject to archival, monitoring or review by, and/or disclosure to,
someone other than the recipient.
***************************************************************************= *********
------_=_NextPart_001_01C24E00.AAB6ABE0--