4 ms·
Looks a lot like promises. Cancellation is missing from Q.js anyway. One thing that always surprises me though is how people rightly are disgusted by callback
by eagsalazar2 13y ago
Looks a lot like promises. Cancellation is missing from Q.js anyway.
One thing that always surprises me though is how people rightly are disgusted by callbacks but think promises/deferreds/futures/etc are nice. They are nicer but doing a lot of async stuff stills sucks big time even using these tools. You will write way more code and it will be way tricker than an otherwise comparable synchronous app.
Obviously sometimes you have no choice but I think one should always strive to minimize the async parts of your app as much as possible.
- sethammons 13y agoOr maximize the async parts of your app as much as possible if you are wanting to build a scalable, distributed system and don't want any blocking calls :)
- coldtea 13y ago>One thing that always surprises me though is how people rightly are disgusted by callbacks but think promises/deferreds/futures/etc are nice. They are nicer but doing a lot of async stuff stills sucks big time even using these tools. You will write way more code and it will be way tricker than an otherwise comparable synchronous app. Well, nicer is all that matters...
- spartango 13y agoPromises, Deferreds, and Futures are all names for the same general idea, that which uses a monad to stand in for the result of operation that may or may not have been completed. There are implementations of this concept for many languages, from Java's futures to C# Tasks to Twisted Deferred to various JS Promise/Future implementations. One thing that I find amusing in the callbacks+/-futures discussion is Google Guava's ListenableFutures (http://code.google.com/p/guava-libraries/wiki/ListenableFutureExplained http://code.google.com/p/guava-libraries/wiki/ListenableFutu...): The JDK ships with Futures under java.util.concurrent, and they do what you would expect. What Guava adds is the ability to use Futures in the "pure" sense (get/check result) and with callbacks or delegates. The neat thing here is that you can use whichever paradigm is appropriate for the design of different modules of your system, and safely mix and match as needed. Guava isn't the answer to all the questions in the Futures world, but I do think it brings a neat idea to the table here.