Now, a few entries ago I talked about a reworking of the interface for version 2.0 and I mentioned avoiding singletons and using a proxy class to access the underlaying window manager.
Well, about 10mins ago it dawned on me; factories!
Its so simple I cant belive I didnt think about it, infact I was virtually there, accept I was going via a class when a simple GetWindowManager() factory function would do the job of managing the object.
Ofcourse, while this allows for the user to call the window manager into existance anywhere it does bring with it a whole host of problems with window handles, which are infact just ints. In theory one part of the program could make a window and get its handle and have another part destory it without the first part knowing, leading to all kinds of fun bugs to track down.
Which brings me back to the idea of a proxy class of some sort, to act as the window handle and allow some safety, there is probably a pattern which will let me do that.
I'm starting to wonder if I'm suffering from a case of over engineering, trying to prevent too many problems instead of just going with a simple 'dont do this, it'll break it' in the docs method.
All this talk of factories and proxies also plays havoc with my idea I had to use templates and polices to define how bits of the code react (from how it recovers from errors to how it handles the events which accure).
Some more thought and alot of diagrams could be needed here I think, work out what I want todo and how I'm going todo it.... still, I wander what Washu wanted *chuckles*