|
Posted by Sanders Kaufman on 07/24/07 23:00
ZeldorBlat wrote:
> On Jul 24, 5:03 pm, Sanders Kaufman <bu...@kaufman.net> wrote:
>> Michael Fesser wrote:
>> You're somewhat correct when you say that it's "more or less just for
>> initialization". It is indeed useful for MORE than just initializing
>> the object. In fact, it's also pretty good at re-initializing the object.
>
> So are you suggesting that you call the constructor from elsewhere in
> the class (or even explicitly from outside the class)? That's just
> poor form. The constructor should be used for one thing only:
> constructing a new instance of a class.
Yeah - that's why, in my original post, I said that for this particular
situation, I'm not concerned with what a "good" programmer would do.
My focus is on if it will result in wasted resources and zombie processes.
> If you want to "reset" the object, then you separate that out into its
> own method and call it from the constructor -- similar to what you've
> done with the Connect() method.
It ain't good form to write redundant code.
It's wasteful, inefficient, and is abhorrent to good OOP architecture.
Indeed - the most powerful reason for using OOP is to be able to write a
process once, and then to use it over and over and over, and in a
variety of creative ways.
Besides and again... my focus here is on not wasting resources
unnecessarily.
Navigation:
[Reply to this message]
|