News for hackers. Stuff that matters.
Re:None of my projects want to be SPAs by WorldMaker on Monday February 11, 2019 @02:08PM (#19137292)
Because I decided I like React? :P

From my perspective, React is the thing with the problem: it doesn't have great state management for complex tasks / multi-component coordination. What I want to use is something like RxJS to manage such interactions and state, because it gives me a lot of power/control in a relatively easy way. One of the best options out there that I've seen is redux-observable, and thus Redux itself is just the "stuff inside the oreo" gluing React to all my interesting "epics" describing high level functionality in the applications.

It's also the Unix philosophy thing of use tools that "do one thing well" and then chain them together. React does view components rather well, Redux does state management rather well, Redux-Observable does state "interaction" rather well. Chained together they work remarkably well.

Re:None of my projects want to be SPAs by machiaweliczny on Monday February 11, 2019 @02:47PM (#19137612)
Have you tried MobX? If yes - could you share your criticism?

I liked it more than redux, because you can have have simple class implementation and side effects without much hassle. Also TS support and testing is easy.

Re:None of my projects want to be SPAs by WorldMaker on Monday February 11, 2019 @04:34PM (#19138558)
I have not tried MobX. It smells a bit too much like Aurelia, and I've been burnt a bit by Aurelia. More generally, too, things that make heavy use of ES2015 Proxies for side effects tend to make me pause, simply by nature of black/gray boxing those side effects, and also making it a little harder to control/throttle them in cases where performance matters more than "magic".

(Which is an interesting turn of events, personally, because I really liked Knockout ages ago, but its attempted successors in MobX, Aurelia, and even Vue leave me cold. I think partly because Knockout was so much more verbose and forced/needed a clearer "MVVM" separation simply by how "dumb" it was, whereas Proxies and Descriptors gives too much of an illusion that you are working with "plain" objects that don't need a clear "MVVM" separation until it is sometimes too late to fix a maintainability/tech debt hole.)

Re:None of my projects want to be SPAs by chrisco255 on Monday February 11, 2019 @02:49PM (#19137625)
Plenty of people pair RxJS with React, including PayPal and Netflix. There is nothing precluding you from doing so. What kind of point is this?
Re:None of my projects want to be SPAs by WorldMaker on Monday February 11, 2019 @04:05PM (#19138341)
Netflix is one of the contributors to redux-observable as well.

Sure, you don't need Redux in the middle of the "oreo", but it's also not the "wrong" answer, either.

Re:None of my projects want to be SPAs by kerkeslager on Monday February 11, 2019 @02:41PM (#19137555)
> From my perspective, React is the thing with the problem: it doesn't have great state management for complex tasks / multi-component coordination. What I want to use is something like RxJS to manage such interactions and state, because it gives me a lot of power/control in a relatively easy way. One of the best options out there that I've seen is redux-observable, and thus Redux itself is just the "stuff inside the oreo" gluing React to all my interesting "epics" describing high level functionality in the applications.

The observer pattern is mentioned in the Gang of Four Book[1], published in 1994. JavaScript first appeared in 1995. Observers predate Redux. You don't need Redux to use observers, and in fact there's nothing about React that is incompatible with RxJS.

> It's also the Unix philosophy thing of use tools that "do one thing well" and then chain them together. React does view components rather well, Redux does state management rather well, Redux-Observable does state "interaction" rather well. Chained together they work remarkably well.

Don't sully UNIX philosophy by comparing it to Redux! UNIX is such a different environment from JS space that it's hard to really even compare the two, but at the very least I think we can agree that "Doing one thing well" in UNIX means not creating a bunch of new problems that you need other tools to solve.

[1] https://www.amazon.com/Design-Patterns-Object-Oriented-Addis...

Re:None of my projects want to be SPAs by WorldMaker on Monday February 11, 2019 @04:23PM (#19138490)
> The observer pattern is mentioned in the Gang of Four Book[1], published in 1994. JavaScript first appeared in 1995. Observers predate Redux. You don't need Redux to use observers, and in fact there's nothing about React that is incompatible with RxJS.

Yes, and before I was using React+Redux+Redux-Observable I was using Cycle.JS and everything was RxJS and/or Xstream (an RxJS-like) observable-based patterns.

As I said, this stack is a useful "oreo" for my needs right now. I understand if "oreo" isn't your cookie of choice.

> at the very least I think we can agree that "Doing one thing well" in UNIX means not creating a bunch of new problems that you need other tools to solve.

Again, I think the problem here is that we are disagreeing on what the problems even are. Again, I don't think these tools "create problems", I believe they solve very specific problems, and yes very "unix" in that way of solving as specific a problem as they can and no larger, and leave other problems that already existed untouched, whether or not they were in play, because again that's the philosophy here. React is "just" a view layer with a bare modicum of state responsibility. Redux is "just" a state layer. Redux-observable is "just" a tool for handling state side-effects. They don't need to solve every development problem, this isn't Angular. Similarly, they aren't the only tools for the job. There are several alternatives to each part of that stack (as others in this thread keep pointing out), this is just the one I've chosen for my projects right now.

Re:None of my projects want to be SPAs by rachkovsky on Tuesday February 12, 2019 @09:43PM (#19149896)
What "state side-effects" are you dealing with?
Re:None of my projects want to be SPAs by WorldMaker on Wednesday February 13, 2019 @12:22PM (#19154674)
The obvious and most common is asynchronous state that has some associated loading process/time. Especially those situations where loading some top level object implies to start loading a collection of lower level objects.

Reacting to object changes (persisting them to a database, or otherwise audit logging them).

Kicking off and managing "background tasks" like chron-job equivalents (5 minutes after a state update do some other related thing, such as a automatic state machine transitions), database synchronization/replication processes, cross-checking/merging in data from GPS/geolocation/compass streams, etc.