mozilla-services/android-sync — comment on commit 27e71e8db89e32f8f982c0088838afe00d384522
File: src/main/java/org/mozilla/gecko/sync/repositories/domain/ClientRecord.java line 37
By rnewman:

> But you said immutability was pretty and useful here! What changed?

Preserving the argument order of the record constructors is important, particularly when you're colliding types: you put "name" in where a string was already expected, which has enormous potential for bugs and confusion.

That aside: convention trumps most everything.

We definitely want to get to immutability for records. But I'll settle for effective immutability: a record's fields are entirely set before escaping some scope.

We have that now, to a point (with the exception of bookmarks): a record is constructed with fields from the envelope and generic payload (deleted), populated with fields from the payload, and then returned. That's a neat convention, with the kind of symmetry that suggests a good design.

And if we make any changes to improve this situation still further (such that we can use final fields, for example), then I'd like it to apply everywhere.