What I like about software development is that after developing software for sixteen years, I can still learn new things. Sometimes, in fact, like this morning, I can learn new things about topics that I thought that I’ve understood in the past, only to find out what I was wrong. I honestly believe that to be a good learner, you need to accept that not everything that you do is correct, and that sometimes you thought they were correct given your understanding of the information available, which in this case is accurate.
This morning, driven by some information that I noticed in the Objective-C documentation for the NSObject class, I decided to do some digging. In earlier posts about NSObject, I was looking at some of the similarities to the .NET System.Object class and the Java root Object class. Specifically, I was looking at the Equals and GetHashCode methods in .NET and their similar constructs in Java and Objective-C. The problem lay with the statements in the Objective-C documentation that said (summarized) an object should give back the same hash code each time and that if two objects are equal, then they should have the same hash code. More...