Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Event bus versus Local broadcast Manager: which one is best

My app is heavily depended on Local broadcast ,for every activity invocation am invoking the broadcast registration method so is it good to move to any event bus.

Two primary concerns of using Local broadcast Manager.

  1. Every activity require the registration
  2. Registration method execution time(Around 10 actions are registered)

I think the event bus will improve overall execution and performance of my app.

like image 734
Bytecode Avatar asked May 16 '16 08:05

Bytecode


2 Answers

Most event bus libraries provide reflection-based registration which is less efficient than LocalBroadcastManager. The main reason for using the event bus would be coding ease.

like image 200
dev.bmax Avatar answered Sep 19 '22 00:09

dev.bmax


afaik, there are some benefits using event-bus instead of LocalBroadcastManager:

  1. Code decoupling.
    By decoupling your code, you will minimize your class which formerly using LocalBroadcastManager. Simpler code less error and improve code readability.
  2. Ease of Maintenance.
    This somewhat related to no.1, decoupled code make it easy to maintained.
  3. Localizing error.
  4. Avoids complex and error-prone dependencies and life cycle issues.
  5. Avoid further bugs.
like image 30
ישו אוהב אותך Avatar answered Sep 18 '22 00:09

ישו אוהב אותך