samedi 8 juillet 2017

Should an Event Queue be static?

I have implemented an event queue system so any class can call the static method EventQueue.execute(event), (and other related functions), without having to carry around a reference to the EventQueue instance.

Is this a bad design decision? I understand that singletons / static methods are often unwise, but an event system is only supposed to have one instance.

Is it okay in this scenario, or should I bite the bullet and carry a reference to EventQueue in every class that needs to emit events?

Aucun commentaire:

Enregistrer un commentaire