|
Posted by Sanders Kaufman on 07/25/07 17:39
Michael Fesser wrote:
> .oO(Sanders Kaufman)
>
>> Yeah - I got that that's HOW to do it. That's easy.
>> I'm wondering WHY to do it.
>
> Correctness? Stability? Style? Reliability?
Stability and reliability are not effected.
>> I don't yet see any reason to NOT use it as a
>> reset-switch for my object; to return it to a pristine state.
>
> A constructor is not a normal method and should not be seen as that.
> Do you know for sure what PHP does internally when calling it? I don't.
Now THAT's an interesting point. But the PHP documentation seems to
indicate that it treats it as any other public function.
> "Abusing" it in the way that you do is not only _really_ bad style, but
> might also cause problems for simple technical reasons.
There's nothing in the PHP documentation to indicate that calling this
public function, even though it's a constructor, is inappropriate.
>> I did have a mild concern that it could result in something called a
>> Zombie process, or that resources would be locked that don't need to be,
>
> Why are you always referring to such zombie processes? Forget that.
> That's not an issue here (and shouldn't be an issue with PHP at all).
Until a few years ago, I'd always been a Microsloth programmer. When I
went *nix, I wrote an article for CNET about using PHP with MySQL. In
it, I connected to a database with "$x = mysql_connect()" instead of the
way their guys liked, which was "mysql_connect() or die".
Their guys said that it would result in Zombie processes - something I
had to dig around to find out about - and I still don't fully understand
them. Since I'm still a loooong way from being a *nix guru, I've been
hyper-vigilant about not accidentally wasting a bunch of resources.
As it turned out, they were wrong. But, like Jerry, they were sooooo
adamant, it turned into a big broo-ha-ha and I've been a bit gun-shy
about 'em ever since.
Navigation:
[Reply to this message]
|