Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » Window without title bar
Re: Window without title bar [message #14139 is a reply to message #14136] Thu, 14 February 2008 18:54 Go to previous messageGo to previous message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
cbpporter wrote on Thu, 14 February 2008 16:53

Anyway, using singleton pattern here is really overkill. Just create and instance variable in MainWin called for example popUp, with type PopUpWin and replace all Single<PopUpWin>() with that given name.

For example,
Single<PopUpWin>().SetPoppedUp(true);
becomes
popUp.SetPoppedUp(true);


In this case you're absolutely right. May I nevertheless point out a few issues?

1.
As Ultimate++ itself uses Single a lot (174 occurrences in uppsrc), I was doing some tests. Coincidentally I used PopUp for this when the popup window issue emerged. At that time I published my code without thinking much about it - it just worked.

2.
Ultimate++'s Single is definitely not a singleton. I just mentioned it because the reason to create these "singles" is the same. And indeed I find the theoretical foundations of the singleton pattern quite interesting.

3.
I do not share your opinion about singletons vs global variables etc.. As soon as you are contributing to large projects with many developers where you don't have complete control over all the code, you will try hard to avoid globals at any cost and do your best to guarantee that one and only one object exists, namely a singleton, if that need arises.

Werner
 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Sometimes, you don't want to update the GUI...
Next Topic: print multiple postscript/PDF in windows
Goto Forum:
  


Current Time: Sun Apr 28 16:45:05 CEST 2024

Total time taken to generate the page: 0.03595 seconds