On 9/6/2012 8:58 PM, Alok wrote:
Nothing is stopping me but the events are all scattered in various
plugins, libraries. As our in house python libraries are humongous
(thousands of lines of code) it will create huge maintenance issues to
put everything into one event. I have used the awesome SetGlobal() and
GetGlobal() for other purposes before and it works beautifully but for
this case it is a bit of an overkill. Never mind, it is not absolutely
needed now, I can think of something later. Anyways thanks for your
insights Alan !
Create your own system of registration for all "sub-events". Then make a
small proprietary API where all your consumers register themselves, with
any extra data needed (priority perhaps? prerequisites?). Build a single
event handler in your main module (I assume there is one) that processes
and dispatches notifications based on what's been registered through the
API.
Do NOT try to put everything in that single event. Get a callback system
in place, running on top of your custom 'metadata' that knows what
should be invoked and when.
It's a lot of work, yes, but if long-term stability and ease of
maintenance are super important to you, the investment in effort will
pay off.
K.