News for hackers. Stuff that matters.
Re:Data Classes for Java by HumanDrivenDev on Wednesday November 01, 2017 @11:13PM (#15607546)
I guess I'd call it "changeLastName". That's closer to the domain, we don't go to the Department of Births, Deaths and Marriage and tell the clerk we want to "set" our last name. But that is being too pedantic, even for me.

I'll concede defeat. That is a pretty good example. At the end of the day, "customer details" class is actually a big bag of fields that needs some access control and validation.

Re:Data Classes for Java by wvenable on Thursday November 02, 2017 @12:22AM (#15607812)
If you get married, you might "changeLastName" or maybe even "rename" yourself but if you're just moving that name from one place to another you'd "set" it.

You could probably come up with lots of different names but none of them will be more clear than "set" in this case.

Re:Data Classes for Java by usrusr on Thursday November 02, 2017 @04:16AM (#15608667)
If moving requires a name to be set you are at constructor time, no need for permanently available setters.
Re:Data Classes for Java by wvenable on Thursday November 02, 2017 @10:35AM (#15610748)
Two things with that, you're assuming immutability but even a simple database entity object wouldn't be immutable. And secondly, anything over a handful of values and setting them via a constructor isn't pretty.