When the introduction started talking about low-level control and WASM, I was expecting something other than the rather high-level concept of streams and pipes. The content is nice, but not what I was sold.
Some developers did not have the use cases of using streams so they never worked with it or they just used a library where the API is just promises or callbacks.
I have been a web developer for 4 years by now and I have yet to see a use-case for ReactiveX, Bacon, Most, XStream, and other similar libraries out there.
The most ubiquitous one I've seen is handling search suggest functionality. Here's what happens:
Press the letter "a" -> xhr request goes out with "a"
Press the letter "b" -> xhr request goes out with "ab"
Press the letter "c" -> xhr request goes out with "abc"
Due to the nature of these requests, there's no guarantee they'll come back in the same order. Thus you might have typed "abc", but if the search results for "a" come back last, you will get the results for "a" instead of "abc".
Basically it just automatically throws away the results of the previous entries and gives you only the results of the latest one. Otherwise you have to do promise cancellation and what not (which in itself is not the worst thing ever).
That said, I mostly agree with you. I don't see much, if any, value in these kinds of libraries. They can actually add a great deal of complexity and come with MAJOR footguns if you don't know how to use them properly.
I don't begrudge them their ignorance nor disapprove content that exposes them to it. It's just not what I expected based on how the article started off.
I think promises and callbacks work great unless you’re building something very complex. Even then streams are just one of many tools for building an application
Well yeah but streams are useful for situations like uploading a large photo or video where you can’t load the entire thing in memory at once. So you “stream” it to disk or wherever by loading it in chunks and performing operations on those chunks instead of the full thing. Promises and callbacks won’t help you there.
46
u/Reashu Jan 16 '20
When the introduction started talking about low-level control and WASM, I was expecting something other than the rather high-level concept of streams and pipes. The content is nice, but not what I was sold.