7

It seems to me like Observables are basically wrappers for promises with some helper methods. It also requires a huge library to go along with it. Do the benefits of these helper methods outweigh the cons of importing a library?

4

1 Answer 1

11

Promises are often used to tackle problems with callbacks. Conceptually promises are futures, so the problems with futures that are mentioned in reactiveX intro link provided by Robert Harvey apply.

Conceptually promises are a subset of observables. Promise is a value that will resolve asynchronously. Most typical example is http requests. Observables deal with sequence of asynchronous events. These events could be mouse positions, clicks, user input etc. So one could say observables are richer and more complex abstraction for handling asynchronicity.

So, calling observables as promises + helper methods is an oversimplification. The answer to your question depends on whether you need to deal with sequence of events or if you can live with "simple" asynchronicity. Libraries like RxJS or Bacon or Kefir add complexity so you'll want to add them only if needed.

1
  • "calling observables as promises + helper methods is an oversimplification" – +1, that's like calling JavaScript "C with hashmap literals". Commented May 23, 2016 at 11:12

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.