Prev: Speaking of thread safety?
Next: solutions manual to A First Course In Probability 7th Edition by Sheldon M. Ross
From: Arved Sandstrom on 12 Mar 2010 05:26 Lew wrote: > sl(a)my-rialto wrote: >>> Someone says if one does not know the difference between "equality" and >>> "equivalence", then one is an entry-level developer at best. >>> >>> What is your opnion ? (I think we should not talk about mathematical >>> concepts, since it is the software developer in question.) > > Patricia Shanahan wrote: >> I think the question needs some context to make sense. Both terms are >> very heavily overloaded in computer science. >> >> For example, consider the following: "The equals method implements an >> equivalence relation on non-null object references:" >> >> http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object) >> >> >> Maybe this is a rather vague way of getting at the following issue: I >> would indeed expect a competent Java developer to understand the >> difference, in Java, between a.equals(b) and a==b for reference >> expressions a and b. > > Well, there we go introducing mathematical concepts, from right there in > the Javadocs, no less!, despite the OP's attempt to eliminate the only > reasonable context in which to answer his point. > Both terms actually have clear English meanings - "equality" means (or should mean) that two things *are* the same, and "equivalence" means (or should mean) that two things can be substituted, that they behave the same way. A mathematical and CS definition in fact tracks the common English meanings of these 2 words, and the language concerning Object.equals that Patricia quoted does say exactly this: equals is an implementation of equivalence. My point is that the common English, the mathematical and the CS definitions of the two terms are pretty much the same. And programming languages that differentiate between the two also track those definitions. We see that Java does. Having said all this I did have to do a few minutes of research to remind myself that the way the words are used in math and in CS are also what they mean in common speech. And I don't normally walk around thinking that equals is an implementation of an equivalence relation. :-) AHS
From: bugbear on 12 Mar 2010 05:37 BGB / cr88192 wrote: > personally, I think many people overstate the role of math in programming in > some ways: Try graphics programming (both 2D and 3D) sometime! BugBear
From: Mike Schilling on 12 Mar 2010 13:24 Patricia Shanahan wrote: > BGB / cr88192 wrote: > ... >> personally, I think many people overstate the role of math in >> programming in some ways: >> when ever was the last time programmers had to seriously invest time >> in things like solving polynomials or writing proofs. > ... > > I have rarely needed to solve a polynomial as a programmer, although I > have had to understand how to solve very large systems of linear > equations. > On the other hand, writing proofs seems to me to be a very practical > activity. For example, I sometimes debug by trying to construct a > proof that the problem could not possibly have happened, taking > things I think are true as the axioms. Given a valid proof of the > impossibility of something that has actually happened, at least one > axiom used in the proof must be false. It is a good way of selecting a set > of beliefs to > investigate. My degree (taken many, many years ago) is in mathematics. I don't use much of the math itself, but the discipline of writing proofs, that is, making sure each step follows logically from the previous ones and that no special cases are omitted, is something I still use every time I write a piece of code..
From: Mike Schilling on 12 Mar 2010 13:33 Arved Sandstrom wrote: > > Having said all this I did have to do a few minutes of research to > remind myself that the way the words are used in math and in CS are > also what they mean in common speech. And I don't normally walk around > thinking that equals is an implementation of an equivalence relation. > :-) I do, but I was trained to think of things that way. hashCode() is too, if you think about it [1], and for hashCode() and equals() to be consistent means that each equals() equivalence set is a subset of some hashCode() equivalence set. 1. That is, the property of having the same hashCode() value is an equivalence relationship.
From: Eric Sosman on 12 Mar 2010 14:19
On 3/11/2010 10:43 PM, Joshua Cranmer wrote: > On 03/11/2010 10:10 PM, sl(a)my-rialto wrote: >> Someone says if one does not know the difference between "equality" and >> "equivalence", then one is an entry-level developer at best. >> [...] > [...] > I'm guessing that the intent is to distinguish between = and ≡. I'm also > trying to think of an instance in computer science where I've actually > cared about the difference between those two... relations. Common LISP has *four* different "equality" predicates: eq, eql, equal, and equalp, plus type-specific tests like char-equal. I'd say that a questioner who thinks "equality" and "equivalence" exhaust the set of possibilities is an entry- level questioner at best. -- Eric Sosman esosman(a)ieee-dot-org.invalid |