Subclassing versus referencing
| From: | Ken Restivo | Date: | Wed, 05 Jan 2005 08:38:08 +0000 |
| Subject: | Subclassing versus referencing | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-16632@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm sorry if this is a basic OOP question, but I've held off against OOP for the last 10
years and finally I've given in. So far, I like. It's made my life a *lot* easier and my
code a lot cleaner.
I've built an object for the main operations and state of my application. And I've
included a reference to the DBDO in it. But after doing it this way for a few weeks, my code is
riddled with $donation->obj->fieldname and $user->obj->joinAdd($donation->obj) and
other such ugliness.
Is there any general rule as to whether and when I should subclass? I was mainly worried about
collisions-- since the bare fieldnames are vars in DBDO-- but I've already taken the FB
approach on some vars, and added them to the DBDO as $kr_thing, and I suppose I could just keep
doing that.
- -ken
- --
- ---------------
The world's most affordable web hosting.
http://www.nearlyfreespeech.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFB26dwe8HF+6xeOIcRAix4AJ4tZagHEzXyLk20GUGVpz/T1hAe1ACfTxDP
Lnk30zC0mDoCDwS1rL6tcMo=
=acVE
-----END PGP SIGNATURE-----