Timeline for Is encapsulation still one of the elephants OOP stands on?
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 6, 2017 at 11:32 | comment | added | Gangnus | The old encapsulation, without mass get/set gave us not only Polymorphism, but also the safety. And mass sets/gets teach us towards the bad practice. | |
| Oct 5, 2017 at 17:41 | comment | added | Alfredo Gallegos | I liked the way you worded your points, well stated. | |
| Oct 5, 2017 at 14:50 | comment | added | jrh | @glennsl I'm not arguing against encapsulation (I think it can be a good thing), and when an object is designed with flexibility in mind, you are absolutely right. I'm saying that the sort of classes the OP is talking about (where all of the state of the object is exposed) don't leave any room for interpretation or change on the object's part because they have no encapsulation at all, ergo there is no room for the behavior to object to differ, because the object has no behavior, only data. | |
| Oct 5, 2017 at 14:24 | comment | added | glennsl | @jrh That's an entirely different issue. You may use it to argue against encapsulation in certain contexts, but it doesn't in any way invalidate the arguments for it. | |
| Oct 5, 2017 at 14:17 | comment | added | glennsl | @Gangnus The word "interface" has meaning outside of just the Java keyword: dictionary.com/browse/interface | |
| Oct 5, 2017 at 13:54 | comment | added | Gangnus | Sorry, it is not an explanation. The fact that using fields is forbidden in interfaces comes from encapsulation idea. And now we are talking about it. You are basing on the facts being discussed. (notice, I am not talking pro or contra your thoughts, only about they cannot be used as arguments here) | |
| Oct 5, 2017 at 13:34 | comment | added | jrh | While a good idea in theory, remember that causing version 2 of an API to throw exceptions that version 1 didn't would break users of your library or class terribly (and possibly silently!); I am a bit skeptical that any major change could be made "behind the scenes" on most of these data classes. | |
| Oct 5, 2017 at 12:35 | history | migrated | from stackoverflow.com (revisions) | ||
| Oct 5, 2017 at 12:03 | history | answered | glennsl | CC BY-SA 3.0 |