News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
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.

0 comments voice your opinion now!
private method protected bad code concept stupid getter setter



Similar Posts

Secunia.com: PHP "glob()" Code Execution Vulnerability

Typical Programmer Blog: Doing it wrong: getters and setters

PHPBuilder.com: Caching Web Page Output for Server Optimization

Jacob Santos' Blog: Object Oriented Programming Isn't Easy

Sameer Borate's Blog: Refactoring 1: Consolidating Conditional Expressions


Community Events









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


mysql zend zendframework PHP5 example cakephp job PEAR ajax package developer book code releases database application release framework conference security

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