Timeline for Is it a bad idea to use getters/setters and/or properties at all?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 8, 2019 at 14:25 | comment | added | ADP | love this answer... | |
Oct 10, 2017 at 23:51 | comment | added | user949300 |
Another problem with exposing values is that it makes it hard to change the implementation. If you have a getter int millisecondsSince1970() and decide that it needs to be a long or a String , you will probably have to change many many places elsewhere in the code. Or, if a String getName() became FancyNameObject getName(); Now, often there isn't really a good workaround, but if nobody "knew" that you were using an int internally, nobody would assume that in their code.
|
|
Oct 10, 2017 at 20:34 | history | edited | JimmyJames | CC BY-SA 3.0 |
hope you are a fan of Fowler
|
Oct 10, 2017 at 20:01 | history | edited | amon | CC BY-SA 3.0 |
added 10 characters in body
|
Oct 10, 2017 at 19:55 | history | answered | amon | CC BY-SA 3.0 |