EDIT: By random I mean a large computed number with no semantic meaning to us as developers
When implementing the Serializable interface its best practice and really important to specify a serial version UID. In numerous places, I often see random numbers being used. E.g.
Effective Java (2nd edition) pg 312:
private static final long serialVersionUID = 234098243823485285L;
From the String class in Java 6:
private static final long serialVersionUID = -6849794470754667710L;
From the ArrayList class in Java 6:
private static final long serialVersionUID = 8683452581122892189L;
etc. Even eclipse offers the option to generate these random numbers (though the primary default appears to be to generate a serialVersionUID of 1L
)
Why use random numbers? Doesn't it make more sense to start at 1L and increment to 2L when it changes like any sensible revision control? The only time I can think of to use a seemingly random number is if you didn't specify a serialVersionUID to begin with and want to do so now (which ties you in to the run-time autogenerated version to provide backwards compatibility support).