I have read in many posts that global variables are bad, but I need them!
My situation:
I have few variables defined in a dedicated module which are updated every minute and are used by other modules in the application. (Implemented after reading this), Do you think its a good approach or needs any improvement or any better idea?
Thanks
This sounds like a good place for the pub/sub technique, where you have objects watch for changes. This is useful in things like GUIs, when you need to update some widget whenever the value it displays changes.
Something very simple:
The idea is that “observers” of the value register a callback, which gets invoked whenever that value changes.