News Feed
Sections




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

Tobias Schlitt's Blog:
Virtual Properties
May 10, 2007 @ 07:57:00

In response to this previous post from Jeff Moore, Tobias Schlitt shares some of his own comments on the subject - mainly that he wholeheartedly agrees.

The usage of interceptors (__get()/__set()/__isset()/__call()) makes your API a lot more readable and comfortable, while maintaining the purpose behind getters and setters: Checking the correctness of values assigned to a property and wrapping around retrieval mechanisms for a property. I personally call the way of maintaining value-correctness for properties through interceptors virtual properties, which fits quite nice I think.

Tobias gives an example of what he means by these "virtual properties" with an illustration from something widely used on the eZ Components libraries - comparing one method of setting text to an object to another (just setting versus the wrappers).

0 comments voice your opinion now!
virtual properties setter getter interceptor ezcomponents virtual properties setter getter interceptor ezcomponents


blog comments powered by Disqus

Similar Posts

Wolfgang Drews' Blog: Very Last Chance: get two eZ Components Trainings for free!

Derick Rethans' Blog: eZ Components 2006.2 released!

Bogdan Albei's Blog: Create your perfect virtualised PHP development environment

DevShed: Utilizing Private Methods with PHP 5 and Member Visibility

Tobias Schlitt's Blog: At IPC2k7 - Hands on eZ Components


Community Events





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


code zendserver framework list voicesoftheelephpant tips language conference series laravel podcast threedevsandamaybe introduction api interview symfony community release bugfix deployment

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