3 ms·
This is a waste of time. No One I've ever seen uses getName. It's always name. Also, most of this is useless overkill. If I have, in this case, a person obje
by tempestrose 2y ago
This is a waste of time. No One I've ever seen uses getName.
It's always name.
Also, most of this is useless overkill.
If I have, in this case, a person object, I'm doing two things with it.
Displaying it.
Editing it.
If displaying, who gives a crap of its mutable?
If I'm editing it, why are you wasting memory making a copy?
This just makes life way more difficult in most business apps.
Sure, if you NEED this, go for it.
But for everyday bog standard business apps?
Get the hell away from me.
- donatj 2y agoTo me, much of this just gives away a lack of experience. Have you never hit a bug because an object mutated unexpectedly? Please do keep this in mind when you do, and spend hours of your life trying to hunt it down. When you've done this 8 or 9 times after wasting days of your life debugging, you become enlightened to the joy of immutability. It's worth the tiny memory overhead. Beyond that, get* is everywhere in of corporate OO especially in more classical OO languages. I'd argue the right way to do things as well, naming methods as actions, but that's a separate issue.
- cess11 2y agoThis was born from needs in the bog where standard business software lives. Sure, you can have naked attributes, but you'll be sorry once they aren't enough and you now have two parallel ideologies seeping through your software, increasing the risk of bugs. Concurrency and collection attributes are the common reasons you'll want getters, possibly also setters.