On Friday, 18 November 2022 at 20:18:41 UTC, matheus wrote:
On Friday, 18 November 2022 at 09:42:21 UTC, []() {}() wrote:
...
I think you missed the point of that video very badly.
By the way just a few points from that video:
Around: 2:32 -> "Never ever put in an 'accessor' until it
actually does something...".
ok. But then you've made the member variable a part of the
interface to the client, and if you even need to constrain the
value being assigned to the member, you will have to break that
interface.
In production-level code, it is rare you would allow
unconstrained access to a member variable. Not unheard of, just
rare. And in any case, a simple accessor allows you to do so,
should you're business rules ever change.
You should plan for change, in production-level code. That's the
'point' missing from that rant in that video.
Around: 3:10 -> "If there is an 'accessor' it had better do
something in there...".
It likely already does something, in that- >'it allows for change
to occur without having to break the clients interface'.
That too is the 'point' missing from that rant.