Re: class? package?
| From: | Iv Ray | Date: | Fri, 13 Jun 2008 10:08:46 +0000 |
| Subject: | Re: class? package? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-275318@lists.php.net to get a copy of this message | ||
Shelley wrote:
I am working on a sns site, and now my practice is grouping classes of a function"classes of a function"... perhaps "classes related to certain functionality"?
(i. e. subscription) together. When I need it, just load the "package": subscription. Right? ;)Hm... I do not know your project, but to have many classes just to handle subscription, sounds a bit too much to me. Why don't you have a class called "subscription", which might even extend a class called "person" or "user" - the "subscription" class can have methods, for instance "subscribe" and "unsubscribe", and because "subscription" extends "person" or "user" - it already "knows" who is the "person"/"user". And then, for example, to subscribe a "person"/"user", you do - $subscription->subscribe($list_id); Other possible actions - $subscription->un_subscribe($list_id); $subscription->is_subscriber($list_id); $subscription->lists(); etc. This way class "subscription" "packs" the methods needed to handle subscription related activities, so in your own jargon, this "class" is a "package". Of course, if the subscription process is extremely complicated, you can have more classes. Iv