3 ms·
TBH both approaches are just poor design of the object model. The one from my link is a clever but inefficient way to manipulate records (reflection), the one w
by ivan_gammel 5y ago
TBH both approaches are just poor design of the object model. The one from my link is a clever but inefficient way to manipulate records (reflection), the one with Lombok is creating redundant interfaces without business meaning. A record with few business methods is lean enough and ensures that only valid transitions can happen.
- stickfigure 5y agoEh? This is pretty good: Colour changed = colour.withRed(5);
- ivan_gammel 5y agoEvery method of your API must serve some business purpose. "With" methods and setters generated or written "just in case" often do not have one or they are being used only in tests, which would be insufficient justification for having them. Does your code really need to change individual components of the color? If it is not a graphic editor, probably not and those methods will be redundant.
- stickfigure 5y agoThat sounds unpleasantly pedantic.