Live data from Hacker News

RxJS is great. So why have I moved on?

medium.com

31–40 of 40 posts

Re: RxJS is great. So why have I moved on?

#31

The article mentions that async/await functionality hasn't landed in Javascript yet. I wonder if you can get the same functionality today using scala.js [0] and the scala/async [1] library. I believe it should work. The scala/async library is just a set of macros that transform blocks of code using async/await into for comprehensions. [0] http://www.scala-js.org [1] https://github.com/scala/async

I have been using yortus' async/await library[1] for a simple personal project and honestly it works fine. I don't know if it's "serious/production" ready but it has a extensive README and examples.

[1] https://github.com/yortus/asyncawait

Re: RxJS is great. So why have I moved on?

#32

Discovering and mastering bacon.js/FRP completely changed the way I think about programming. It hugely increased the quality and stability of my code in ways that continue to surprise and amaze me. I cannot recommend it enough, but this article definitely has me curious about ClojureScript. In the meantime, the biggest issue I've had with bacon is figuring out what are the best practices in organizing the code. One d…

You should look into Cycle.js[1] to better organize front-end FRP applications.

[1] http://cycle.js.org/

Re: RxJS is great. So why have I moved on?

#33

Earlier quoted context omitted.

I started recently, but I find them fairly decent. And there is not much to it, really. > I didn't think it had the equvalent of Reagent's reactions until I got towards the bottom of the react-redux page Is that the subscription mechanism? I have yet to find a use for it...

> And there is not much to it, really. The two use the same model but are organized differently so it throws me off a bit. Re-frame chooses to hide the actual reduction step so instead of the big switch statement you have a bunch of registered event handlers, which are pure functions take the state and event and return the new state. The middleware is HoF around these so it's done per-handler as well as at the base r…

This sounds like an interesting approach, though I'm not really fan of events (it's easy to see when they fire, but less easy to make sure anything is listening).

Re: RxJS is great. So why have I moved on?

#34
post #4

Core.async is not a substitute for Rx. As a disclaimer I'm the author of an Rx-inspired library for Scala [1] and that also works for Scala.js in the browser. Shameless plug aside, Scala also has Future/Promise in its standard library and now due to macros support it got scala/async [2], a library that gives you the "await" keyword in Scala, so in Scala you also get this kind of M:N multithreading that looks like syn…

I see (and use) core.async as low level primitives from which to build higher level FRP, reactive, flow-based or message-based systems.

For example, re-frame, zelkova (Elm-like thing in ClojureScript[1]) and others (eg the in-house thing I wrote before I came across re-frame) are implemented using core.async

So, no, its not a substitute - its a (potential) building block.

[1] https://github.com/jamesmacaulay/zelkova

Re: RxJS is great. So why have I moved on?

#35

RxJS is not designed to be pull-based which makes it hard to use it for something else than UI code. I hope this will change with RxNext.

I just built something using RxJS that is pull-based. The easiest way I found was just to have a timer that calls subject.next(), and the subject calculates its next value and calls this.onNext(value) which pushes to the subscribers.

I was expecting more pull based support.

Is this what you are talking about ? https://github.com/ReactiveX/RxJS/pull/138

It looks like its already merged in.

Re: RxJS is great. So why have I moved on?

#36
If you feel that RxJS is a bit hard, but don't want to go all crazy and switch to ClojureScript; then Redux is pretty good. It's not as "powerfull" as RxJS and it has some guidelines on how you should structure code. It also have very good tooling integrations, and debug-ability.

Re: RxJS is great. So why have I moved on?

#37
If you feel that RxJS is a bit hard, but don't want to go all crazy and switch to ClojureScript; then Redux is pretty good. It's not as "powerfull" as RxJS and it has some guidelines on how you should structure code. It also have very good tooling integrations, and debug-ability.

Re: RxJS is great. So why have I moved on?

#38
RxJS has a steep learning curve and is quite hard to really understand beyond basic examples that fit on a presentation slide. It might be a great tool for really smart developers, but I wouldn't share any large RxJS code in a developer team where all developers are not at least 200% geniuses.

The whole thing reminds me of C++ years ago, where the language allowed for really smart and efficient coding style, but many less skilled developers at the time had problems with deep understanding of templates, operator overloading, multiple inheritance, various constructors and such. Pragmatic companies (e.g. Mozilla) thus decided to ban all the advanced features and stick just to basic ones so that the code would be maintainable.

I think RxJS is facing similar fate. I've spent quite some time learning it and I think it is one of the more complex paradigms on the market today. In addition there isn't much useful documentation. Feel free to check stack overflow and find out about the struggles people are going through tying to extend basic examples (e.g. google for rxjs mousedrag).

Re: RxJS is great. So why have I moved on?

#39

The article mentions that async/await functionality hasn't landed in Javascript yet. I wonder if you can get the same functionality today using scala.js [0] and the scala/async [1] library. I believe it should work. The scala/async library is just a set of macros that transform blocks of code using async/await into for comprehensions. [0] http://www.scala-js.org [1] https://github.com/scala/async

Yes, Scala.js and scala-async work together out of the box.

Re: RxJS is great. So why have I moved on?

#40

Discovering and mastering bacon.js/FRP completely changed the way I think about programming. It hugely increased the quality and stability of my code in ways that continue to surprise and amaze me. I cannot recommend it enough, but this article definitely has me curious about ClojureScript. In the meantime, the biggest issue I've had with bacon is figuring out what are the best practices in organizing the code. One d…

CycleJS, which is based on RxJS and smaller than most of the "full blown" frameworks and SPAs, I think has a good approach to code organization in its MVI (Model-View-Intent) documentation: http://cycle.js.org/model-view-intent.html For a couple of projects I'm working on I've been slowly iterating towards one sort of deeper formalization of Cycle's MVI, but I haven't published any of that work yet.

Loving cycle.js so far, thanks for the tip!
Post reply on HN