Ask HN: POJO with Setter Logic or Not?

1 points by mister_hn ↗ HN
Hi

I'm continuously fighting with my team manager over design decision for some Java code. I've implemented a utility library that can be reused in multiple projects, handling generic cases as well as offering the flexibility to configure it fine-grained.

Now, for some POJO classes, I've preferred to use some logic in the setters, since the ones who are integrating this library don't have to write their own verification on valid/invalid parameters (think of it like setters with defined contracts).

Of course, this type of design was rejected since it doesn't adhere with POJO design, but on the other hand, I sustain that DRY and testing once with attention is better than spawn code duplicates and trying to write logic that might broken easily.

What do you thing about it?

0 comments

[ 3.4 ms ] story [ 9.7 ms ] thread

No comments yet.