|
Posted by Sanders Kaufman on 07/25/07 17:58
Toby A Inkster wrote:
> Sanders Kaufman wrote:
>
>> The best answer came from Jerry when he said it was for purely academic
>> reasons - to keep tight with the OOP design principles.
>
> How about this... what happens when one day you decide that your
> constructor should do something over and above what the reset function
> does?
>
> For example, your reset function might want to just reset the object to
> its initial state, but the constructor might also want to log some
> debugging messages to a file.
I think that in that particular case, I would allow both functions to
log the debug messages.
I see what you're saying - but I don't forsee a situation where I would
have the two perform in different ways - not with my programming style,
anyway. If that were to change, I'd probably add a boolean "DebugMode"
parameter to the constructor.
Navigation:
[Reply to this message]
|