News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Chance Garcia's Blog:
Visibility and inheritance
August 12, 2009 @ 09:40:20

In this recent post to his blog Chance Garcia looks at visibility and inheritance in PHP applications. Specifically, it references a question that came up on IRC about the "default" visibility for methods and the open/closed principle.

Out of the whole discussion, here is the points I got (aka understood) out of it. Please correct me in the comments if I'm off base in any way.

There's two points he makes in the remainder of the post:

  • Methods should only be public when necessary.
  • Private methods allow you to preserve the class' core functionality.

There's also a bit of code included to illustrate some of his points.

0 comments voice your opinion now!
visibility inheritance openclosedprinciple


blog comments powered by Disqus

Similar Posts

Matthew Weier O'Phinney's Blog: On Visibility in OOP

PHPMaster.com: Layer Supertype Pattern: Encapsulating Common Implementation in Multi-Tiered Systems

PHPMaster.com: Reusing Implementation - a Walk-through of Inheritance, Composition, and Delegation

Mattias Noback: Backwards compatible bundle releases

DevShed: Protecting PHP 5 Class Data with Member Visibility


Community Events





Don't see your event here?
Let us know!


introduction framework install composer voicesoftheelephpant security language update opinion interview library symfony community podcast tool package series release version laravel

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework