Re: DB_DataObject: what am I missing?
| From: | Larry Garfield | Date: | Sun, 23 Jan 2005 21:05:22 +0000 |
| Subject: | Re: DB_DataObject: what am I missing? | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17114@lists.php.net to get a copy of this message | ||
Justin Patrin wrote:
By call-time-pass-by-reference, I presume you mean: $a =& new b(); $c = d(&$e); Coming from a C/C++ background, I'm used to that sort of syntax. I understand PHP5's object model is much more Java-ish (pass by copy of reference, so effectively all objects are pass by reference), so that clears up some things but messes others. Is that why the syntax is deprecated? For those of us stuck with web hosts who are still on PHP4, then, your suggestion would be to just skip getters/setters and write unencapsulated until they wise up and get PHP5? I'm not particularly fond of that idea. :-) -- Larry Garfield AIM: LOLG42 larry@garfieldtech.com ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas JeffersonThe current bug aside, why are people so against overloading? Without the accessor/modifier methods, you have to access the data directly, which breaks encapsulation. (Yes, I happen to like OO concepts. <g>) You could just write them yourself (as you would have to in Java or many other languages), but then you're losing half of the point of using DBDO in the first place.Because it breaks pass-by-reference. You have to use call-time-pass-by-reference to get around it, and that's deprecated and causes warnings. Getters and setters can be nice, but IMHO overloading should not be used in PHP4 as it breaks things. It should have been kept for PHP5 which does not have the same issues.