Apr 19 at 11:06am, Chris W. Parker wrote:
> Torsten Roehr <mailto:[EMAIL PROTECTED]>
> > One personal suggestion: you could directly put the code from
> > initialize_customer() into the constructor.
> 
> but i'm thinking that i might, at some point, want to use that method
> after the object has been instantiated. i can't think of a specific
> case, but i'm only imagining that it's possible.

You could conceivably call the constructor as any other method, such as
$obj->Customer(35); ...so, you could collapse it all into a single method.

I think that is not as logical, and you may want to change the
functionality of the constructor later, independent of the method to that
loads the data from the DB, so personally I'd leave it.

Further, I think it's best to keep the constructor as simple as possible,
and try to avoid the temptation of doing too much fancy work there. (Save 
it for a convenient use, like what you have done...)

Reason being, you may want to use the object more generically later.
Perhaps you would write a script that queried the whole user table, and
instantiated many Customer objects.

Sometimes putting too much into the constructor can add overhead if you
want to create lightweight instances of the object for another purpose
that you're not envisioning at the moment.

-- 
Kelly Hallman
// Ultrafancy

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to