Honestly, I expect that half the classes I write will be records, once I have access to this.
A lot of the time, the software I'm working on has data objects that are really amalgamations of other fields. Example: "Address" is the street address, the city, the postal code, etc, etc. These sorts of objects should be immutable. Records are perfect for that.
If I need to add additional logic, methods, then you can add those to a record. But it continues to enforce that the state is immutable.
A lot of the time, the software I'm working on has data objects that are really amalgamations of other fields. Example: "Address" is the street address, the city, the postal code, etc, etc. These sorts of objects should be immutable. Records are perfect for that.
If I need to add additional logic, methods, then you can add those to a record. But it continues to enforce that the state is immutable.