Timeline for Reduce DRY for different classes which have the same data model
Current License: CC BY-SA 4.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 10, 2019 at 19:49 | vote | accept | James | ||
| Oct 30, 2019 at 2:58 | comment | added | casablanca |
the immutable version of the class is truly immutable - this isn't totally accurate and it actually breaks LSP, because a reference of type ImmutableUserDto might actually point to an instance of MutableUserDto which is mutable. It would be better to have a UserDto class and a UserView interface that only provides read access (but whose contract specifies that the underlying data might actually change).
|
|
| Oct 29, 2019 at 21:49 | comment | added | James | Interesting ideas, thanks! Yeah I don't need immutability for anything hardcore, just good practise as it's DB/API data that should be relatively safe. Devs can do what they want anyway so any of this only works if people use it properly. Cheers | |
| Oct 29, 2019 at 18:53 | history | answered | Berin Loritsch | CC BY-SA 4.0 |