News Feed
Sections




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

Debuggable Blog:
Programming Psychology II Private methods
July 08, 2008 @ 08:44:58

According to Felix Geisendorfer's newest post on the Debuggable blog, he thinks that "private and protected methods and properties are one of the most stupid concepts of OOP."

This is a thought I first shared at CakeFest Orlando this year, but could not explain properly at the time.

He illustrates with an example of a protected "balance" variable in a BankAccount class. Sure, it's marked as private but less skilled programmers might not use it that way. He recommends a method without the getters/setters to help make the usage of the variable a bit simpler. He also suggests that using protected/private scoping helps to promote "crappy code" - using them to provide a sort of protection for code that you either don't want getting used or hiding it away so the API can't get at it.

1 comment voice your opinion now!
private method protected bad concept stupid getter setter


blog comments powered by Disqus

Similar Posts

Michael Kimsal's Blog: magic __get and __set style?

Kevin Schroeder's Blog: Handling ZF2 FQ Dependency Setter Injections

Mike Purcell's Blog: PHP - Reflection Class - Determine Parent Method Signature

Johan Mares' Blog: Running PHP CLI shell scripts

Lorna Mitchell's Blog: Declaring Static Methods in PHP


Community Events

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


api php7 community install opinion voicesoftheelephpant language podcast xdebug example framework library laravel series release extension introduction unittest laravel5 interview

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