Question

In an application framework when performance impact can be ignored (10-20 events per second at max),
what is more maintainable and flexible to use as a preferred medium for communication between modules - Events or Futures/Promises/Monads?

It's often being said, that Events (pub/sub, mediator) allow loose-coupling and thus - more maintainable app... My experience deny this: once you have more that 20+ events - debugging becomes hard, and so is refactoring - because it is very hard to see: who, when and why uses what.

Promises (I'm coding in Javascript) are much uglier and dumber, than Events. But: you can clearly see connections between function calls, so application logic becomes more straight-forward. What I'm afraid. though, is that Promises will bring more hard-coupling with them...

p.s: the answer does not have to be based on JS, experience from other functional languages is much welcome.

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top