Reply to Re: Constructor as a "Reset" Button

Your name:

Reply:


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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация