Futures/Monads vs Events
Posted
by
c69
on Programmers
See other posts from Programmers
or by c69
Published on 2012-09-25T00:20:22Z
Indexed on
2012/09/25
3:49 UTC
Read the original article
Hit count: 236
So, the question is quite simple:
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/Promices/Monads ?
Its 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.
Promices (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 Promices 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.
© Programmers or respective owner