I’ve got a question about an architecture af a complex GUI app.
I’m creating such app and have many, many windows which often interacts with each other, and I’m facing problem of having all needed references to other windows within them.
What is the best approach to manage those windows?
First think I came up with was to create global singleton sharing all windows references (and encapsulate them in getters/setters) and each windows would have only reference to that, let’s say ‘window manager’ – but generally I don’t like that type of programming (I’m anti-global :P), I consider it’s bad and unsafe.
Are there any paradigms/design patterns am I missing?
Appreciate any useful tips,
Maciek
You need an application wide “controller”. Think of it like a central DNS. It doesn’t have to be a special “global singleton”. Your application will already have one of those (the root object of your app). Just have it manage a list of windows.