Object Equality
Introduction One of the first code smells we encounter when working with an object-oriented language where everything is an object, or everything subclasses a common base class, or there are no static methods, is how OOP typically handles equality of objects.
For value types such as integers and floating point numbers, it’s not controversial that we should be able to compare them and decide if they’re equal or not. Integers can be compared by bits, and data structures can be compared by descending into the structure and comparing elements.
read more