[RESOLVED] MessageBox etc. in a constructor, would you do that?
what do you think, is showing a message box in a constructor of some class a bad practice? (or any other interaction with the user while initializing an object)
Re: MessageBox etc. in a constructor, would you do that?
yours becomes jerking and looks ugly right from the start
Re: MessageBox etc. in a constructor, would you do that?
No, I wouldn't recommend doing that. Your object is then tightly coupled to your GUI. If you want user interaction to decide whether or not a task should take place, you should do that before constructing your object.
Re: MessageBox etc. in a constructor, would you do that?
Re: MessageBox etc. in a constructor, would you do that?
Quote:
Originally Posted by
boudino
Shortlly: No, it isn't.
Are you saying that it is not bad practice to show a messagebox from a class constructor? Going to have to disagree with you there. The UI layer should be responsible for the UI, otherwise you have this tangled mess of code and, when inevitably more than one messagebox is popping up because of some error, you have to start digging through class files to find them and get rid of them. Poor, poor design.
Re: MessageBox etc. in a constructor, would you do that?
Damned! I've anwer another question... I definitely want to say that I consider it is bad practice to show message box in a constructor. Thanks for your notice.
Re: MessageBox etc. in a constructor, would you do that?
ok, you've convinced me not to do it ;)
Re: MessageBox etc. in a constructor, would you do that?
Great, now if we can just get you to use '_'.