Timeline for use always get and set methods is a bad practique, is call directly an attribute class a bad practique in OOP?
Current License: CC BY-SA 4.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 1, 2019 at 0:13 | comment | added | Patrick Hughes | I think that it's far easier to read code and refactor classes when a semantically meaningful method is used over accessing properties directly. For example: if you have a LightSwitch class I want to say lightSwitch.TurnOn() instead of saying lightSwitch.onOffState = true; | |
| Feb 27, 2019 at 17:10 | comment | added | bitsoflogic | Of course, pure OOP (in the Alan Kay sense) is a great idea | |
| Feb 27, 2019 at 15:31 | comment | added | Deduplicator | Of course, pure OOP is rarely a good idea. | |
| Feb 27, 2019 at 15:09 | vote | accept | Tlaloc-ES | ||
| Feb 27, 2019 at 14:28 | comment | added | Tlaloc-ES | I think this too and for these reasons, I like to use get, but is there cases for use call to attribute like in structured programming when you are using OOP approach? is a mix not a bad option? | |
| Feb 27, 2019 at 14:19 | history | answered | Aganju | CC BY-SA 4.0 |