Theory question
| From: | Daniel Masson | Date: | Fri, 01 Nov 2002 21:42:09 +0000 |
| Subject: | Theory question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122460@lists.php.net to get a copy of this message | ||
Hi every1
This is a theorical question about the best way to use classes.
I have a class named anything, and also theres a table named ahything ..
The class attributes are the same fields of the table like this
Class anything {
var $something1;
var $something2;
var $something3;
}
And the table 'anything' has 3 fields they are something1 , something2,
something3, my question:
I have a method in the class that retrieves the values for the 3
attributes from the table, there are many scripts that use this method
to get the data, but not all the scripts uses the 3 attributes, for
example a script calls the method just because only needs the attribute
something1. should i write one method to retrieve each attribute ? Or is
just fine that one method gets all data, and the scripts only uses what
it needs ?? Of course, the real class has more than 3 attributes it has
10 attributes
Thanks
Any help would be very useful.
Daniel.