I can't think of many reasons (or any at all) in which multiple independent user interfaces should be instantiated in a desktop application. Is it good practice to implement the UI as a singleton? Are there are advantages or disadvantages to this approach?
uh...i open multiple copies of Internet Explorer, Word, and Excel all the time!
EDIT: I also have several emails open at once in Eudora
I see no good reason to restrict a user-interface to a singleton...
I can think of a couple:
1) Document interfaces. If your application deals with documents, it's better to let each one have its own window. It makes it easier for the user to arrange their workspace and switch between documents using the OS's app switching capabilities. A lot of MDI applications prevent this by corraling multiple documents into the same window, which limits usability of screen real estate in a multiple monitor scenario.
2) Views. It's often the case that several different views on the data behind your UI cannot be easily combined in a single UI instance. You can't always predict what combinations of data your user will want to see at the same time, so it's better to give them the flexibility to instantiate multiple UIs.
As an aside, it's worth noting that many people consider Singleton an anti-pattern.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With