Re: DB_DataObject's class generator

From: Date: Wed, 08 Dec 2004 00:01:58 +0000
Subject: Re: DB_DataObject's class generator
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16097@lists.php.net to get a copy of this message
Torsten Roehr wrote:
Hi, is there any specific reason why DO's class generator does not produce getter methods for the class properties? Wouldn't this save a lot of work for the developer?
It would, if the developer wants to use those ;-) I got no benchmarks at hand, but I've heard numerous times that method calls are always slower than property assignments, so unless really needed, you should rely on setting values directly. Also, there's theoretical support for overloading (__call() intercepting all calls to undefined methods) which could be used in a base class for all DataObjects, so you'll always have getters/setters but they only do standard property access unless you define a method that does something special in any of your DataObject classes. Hope this was somehow understandable. However, because there are manymanymany bugs with overloading in PHP4, I wouldn't recommend this - PHP5 is supposed to do better in this department, but I haven't tried myself. Regards, Markus

« previous php.pear.general (#16097) next »