Re: Java Code Convention Guidelines question...

From: rkm (rkm_at_invalid.com)
Date: 01/06/04


Date: Mon, 05 Jan 2004 16:48:42 -0700

Chris Smith wrote:
> rkm wrote:
>
>>"dangerously misleading"?
>>
> Yep.
Yep isn't good enough. You need to provide an example.

>>how so? how is it dangerous? Aren't most all of you being
>>more pedantic than anything? First of all, I'm pretty sure
>>you cannot write an instance method that overrides a static
>>method of the same signature (but maybe it's just my
>>compiler that cares), so there is no danger of accidentally
>>invoking an instance method where you intended to
>>invoke a class method.
>
>
> That's not the issue. The issue is invoking a static method while
> thinking that it is (and therefore expecting it to act like) an instance
> method. Since the two behave in completely different ways, this could
> add bugs to code very easily.
>
Again, show an example.

>
>>Second of all, should code really be
>>written that depends on knowing the difference between
>>whether you're invoking an instance or class method?
>
>
> Yes. Why wouldn't your code know the difference? It's not as if this
> is an implementation detail. It's a fundamental question about what you
> are doing! If I look at code and can't tell whether it's invoking a
> static or an instance method, that's a serious problem!
>
How is it a problem? An example please!

>
>>Should your algorithms be that brittle?
>
>
> Not sure what you mean. Since the two are completely different things,
> I can't really imagine a situation where I'd actually choose between the
> two. Certainly code can't be written to just work in the context of
> just any arbitrary change... I could ask you "are your algorithms so
> brittle that if I change the value of some constants they would fail to
> work?", and you'd probably be just about as much at a loss for how to
> answer as I am right now.
>
Let's not confuse things by extending the argument to "any
arbitrary change". No-one said that.

It all sounds nice, but can you show a real example that
illustrates what you're saying?

Rick