Wednesday, July 16, 2008

Of Reading, Posting Comments, and Debates

I can't for the life of me figure out how to get a comment to post on Ted Neward's blog article critiquing the discussion in my previous post. Perhaps my comment is being moderated, but the system didn't say so.

So I'll put it here.

[Edit: whatever was wrong seems to be fixed now. I was able to post a comment, but the original seems to have been eaten. That's okay, it's more complete here.]

In Neward's article he takes everybody to task. And he raises some valid points, which I'll get to at the end, but first there are some factual errors.


Neward:> Citing yourself as the final authority. At no point during the debate does anybody reach for their copy of Effective Java

Well, not Effective Java, but there's plenty of arguing from authority with quotes and everything. The authority in this case is Sun's Javadoc for the Java standard library.

(10:05:37 AM) JamesIry: From the doc: The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value
...
(10:08:44 AM) JamesIry: Also from the doc: As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)
...
(10:14:26 AM) dysinger: "If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result. "


Neward:> nobody even considers the possibility that different JVMs can have different implementations

(09:37:58 AM) ijuma: hashCode is not necessarily good enough because it's an int and you may be running a 64-bit machine
(09:38:23 AM) ijuma: I mean System.identityHashCode above
...
(09:46:50 AM) JamesIry: Read the spec for identityHashCode
(09:47:18 AM) JamesIry: It says not one word about uniqueness guarantees. A perfectly legal JVM could return 0 everytime the method is called.
...
(09:58:10 AM) JamesIry: The fact that a particular jvm uses an object's unique handle as a hashCode is an implementation detail
...
(10:09:10 AM) JamesIry: Note the caveat: this implementation technique is not required by the JavaTM programming language.


Neward:> At no point, near as I can tell, did any of the participants bother to say, "You know, you could be right, but I remain unconvinced. Can you give me more information to support your point of view?"

(10:04:19 AM) JamesIry: dysinger please point me to the line in the JLS that says that "==" uses class and hashCode. There's no need for us to argue. Just point it out to me
...
(10:13:43 AM) dysinger: show me the code


Neward:> Nobody ever really gets around to answering the question because they're too busy arguing their position or point. Poor "doub",

(09:57:24 AM) doub: but I agree with all you said JamesIry, and I would use .eq for a production system


Neward:> Here's a tip for all of you: Try listening

And right back at you, Ted.


Where was he right? Well, right here:

Neward:> The interesting thing, though, is that this conversation has nothing to do with Scala.

Exactly. In fact, with only a bit of renaming it could have been held in #java. With only little bit more extra work most of it could have been about any language that supports distinct concepts of identity and semantic equality - which is a heck of a lot of them. It also impinges on the concept of hashing, which is a fairly universal CS tool - and even on a concept I learned as The Pigeon Hole Principle.


Neward:> And frankly, I find the dig at the academics to be a tad disingenuous.[...]Way to bite the hand that makes your life easier, [Tim Dysinger]....

Very well said, Mr. Neward, very well said. Except the part I edited which actually said

Neward:> Way to bite the hand that makes your life easier, folks....

I'm not sure who else took a shot at academics there, but whoever you are, I'm on Ted's side!

No comments: