note 52228 deleted from language.oop5.constants by danbrown
| From: | danbrown@php.net | Date: | Wed, 03 Aug 2011 13:30:28 +0000 |
| Subject: | note 52228 deleted from language.oop5.constants by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182183@lists.php.net to get a copy of this message | ||
Note Submitter: esad at 25novembar dot com
----
Refering to caliban at darklock dot com's article:
The whole idea of visibility is implementing the concept of data hiding and encapsulation. This
means exposing as little as possible of the class variables/methods, in order to maintain loose
coupling. If you reference all your variables in your class directly, you've probably missed
the point of OOP.
If the variable visibility is set to private it shouldn't be readable outside the class
(performing tricks to read it is pointless, if you want to read something, make it public, it's
your code). This is not used to obfuscate/hide a variable from someone but to enforce good coding
practice of maintaining the loose coupling between objects.
http://c2.com/cgi/wiki?CouplingAndCohesion