#55 suboptimal VO-hashCode() implementation

open
None
5
2014-08-23
2002-05-28
Anonymous
No

Generated hashCode() implementations of ValueObjects
look quite nice but they are suboptimal in respect to
computational efficiency:
Instead of naive multiplying with prime number, you
should rather XOR the hashCode-values of the
ValueObjects' chield attributes. Assuming that these
hashCodes are already implemented to scatter fairly,
XOR will provide best scattering of merged results.
Furthermore, bit-wise XOR is a cheaper operation that
multiplication.

Regards,
Christoph

Discussion

  • Vincent Harcq
    Vincent Harcq
    2002-06-09

    • labels: 350996 -->
    • milestone: 196972 -->
     
    • assigned_to: nobody --> ara_e_w