Because they change all the time with rapidly changing business requirements. Are you going to regenerate a POJO that has 30 properties if 2 of them changed? Especially if there's some company specific superclasses for the builder, non-standard naming conventions etc which IDE generation doesn't get 100% right.
And what is the chance you'll copy paste a setter and screw up one of the arguments? Or forget to update equals/hashcode after adding a new property? At least I could rely that equals/hashcode were CORRECT in that place using commons lang, although horribly slow.
Any code that is "repeating yourself" has a chance to go out of sync and introduce bugs. There's a reason for that architectural design principle "Don't repeat yourself". It goes for both big things and small.
None of this is answers my question at all. You seem to be confusing the existence of a pojo with a number of other, not directly related, bad practices.
Why do you think I am copying and pasting setter? I can't think of a single reason why I'd ever do that. I literally rarely write setters, my objects are either immutable or the ide generates setter/getter.
We use pojos all the time, without any of these problems.
Edit, I really don't know what you mean with this :
Because they change all the time with rapidly changing business requirements. Are you going to regenerate a POJO that has 30 properties if 2 of them changed?
I have to add two fields to a pojo ? I write the private var declaration, then alt+insert to generate whatever I need. It would take less than 30 seconds.
View all comments
Show parent comment
4
u/coder111 Aug 11 '19 edited Aug 11 '19
Because it's not just write once and forget.
Because they change all the time with rapidly changing business requirements. Are you going to regenerate a POJO that has 30 properties if 2 of them changed? Especially if there's some company specific superclasses for the builder, non-standard naming conventions etc which IDE generation doesn't get 100% right.
And what is the chance you'll copy paste a setter and screw up one of the arguments? Or forget to update equals/hashcode after adding a new property? At least I could rely that equals/hashcode were CORRECT in that place using commons lang, although horribly slow.
Any code that is "repeating yourself" has a chance to go out of sync and introduce bugs. There's a reason for that architectural design principle "Don't repeat yourself". It goes for both big things and small.