This is one of the reasons why I think more thinking of the project hierarchy to enable easier use of submodules is a good idea.
It may seem useless for solo developers; if I wrote the class, I should know what should be public and what should be private.However, being able to declare things private means:
- you don’t have to remember, it’s explicit
- the next person doesn’t have to know the parts you kept in your head, the code is explicit
- the IDE can help you by not offering to autocomplete private functions/members when you should only have access to the public interface.
I agree as well. The more I go back and refresh my head as to all think object-oriented I’m reminded that it’s not just function organization. It’s about ONLY exposing a public interface. Anyone - including the developer - should not be able to access a private property outside the scope of the class. Access to should always be via a message which is a public function call. Otherwise, and I can testify to this, it’s hard not to write spaghetti code.
Anyway, I think (maybe wishful) down the road 4D must be moving in that direction. It makes too much sense.
I am trying to think through and see if there are ways to accomplish this. Naming is helpful when you are looking within the class - but if you could still access via ‘class._someProperty’ then you would have to remember the discipline of not accessing anything that begins with, for example, an underscore unless you were within the class and then it would be ‘this._someProperty’.
Anyway, I’m trying to figure out how far we can go with this object-class paradigm before I go crazy trying to design anything.
I am very interested in hear further thoughts about approaches.