Talk:Equals vs the Encapsulation Boundary
Line 1: | Line 1: | ||
This is the result of a group discussion between Ben, Alex, Matthew, Michal and Stephen --[[User:Matthew Harward|Matthew Harward]] 05:08, 30 July 2009 (UTC) | This is the result of a group discussion between Ben, Alex, Matthew, Michal and Stephen --[[User:Matthew Harward|Matthew Harward]] 05:08, 30 July 2009 (UTC) | ||
+ | |||
+ | I would agree with Wal that you shouldn't need equals() often in the case where you are simply checking to see if two objects are the same object. However, this still leaves the equivalence case, which I think is much more reasonable. I disagree that the equals() method is likely to only be checking things which are publicly accessible. I think that much of the time equals() will be checking private things. In this case I would ignore the evil of class encapsulation, and simply use it to our advantage. In languages which don't even allow class encapsulation I'm at a loss. --[[User:Aidan|Aidan]] 09:56, 1 August 2009 (UTC) |
Revision as of 09:56, 1 August 2009
This is the result of a group discussion between Ben, Alex, Matthew, Michal and Stephen --Matthew Harward 05:08, 30 July 2009 (UTC)
I would agree with Wal that you shouldn't need equals() often in the case where you are simply checking to see if two objects are the same object. However, this still leaves the equivalence case, which I think is much more reasonable. I disagree that the equals() method is likely to only be checking things which are publicly accessible. I think that much of the time equals() will be checking private things. In this case I would ignore the evil of class encapsulation, and simply use it to our advantage. In languages which don't even allow class encapsulation I'm at a loss. --Aidan 09:56, 1 August 2009 (UTC)