These are chat archives for jdubray/sam

6th
Jul 2017
Victor Noël
@victornoel
Jul 06 2017 08:20
@jdubray I don't like REST either, which of my comments are you answering that to?
Jean-Jacques Dubray
@jdubray
Jul 06 2017 13:25
nothing in particular, just commenting on vsavkin trying to align with the REST semantics. There are gems in REST, for instance we should be talking about idempotent actions. In a world of documents there is no "state" as we understand it. A document is there, and will sit there forever, but the better analogy is to say that there are some "states" that are idempotent, those are the ones a "route" can point to, i.e. where the corresponding action can be triggered by a route. In other words, each time you apply that particular action, the state (representation) will be the same (I think it's better to talk about state representation than model, it would be expected that the model property values could be different but the state representation would be idempotent).
Jean-Jacques Dubray
@jdubray
Jul 06 2017 13:31
React bashing has officially started: https://twitter.com/nzgb/status/882601338932219904
"For every API call you need to create { action, reducer, selector, ...rest }, this is super verbose (slow) Plain fetch is more productive"
Fred Daoud
@foxdonut
Jul 06 2017 14:57
@jdubray You should say Redux bashing, not React per se.
Jean-Jacques Dubray
@jdubray
Jul 06 2017 15:16
sure, sorry :-)
but React without Redux is possibly worse than both combined
React is becoming a house of cards: https://twitter.com/francoisz/status/882965884842762240
Fred Daoud
@foxdonut
Jul 06 2017 15:28
@jdubray I have to disagree with you on that. I don't think there is anything wrong with React as just a virtual-DOM library.
devin ivy
@devinivy
Jul 06 2017 15:28
react and redux as tools are great. are you referring to the community's typical practices?
react has its quirks but really is quite good
and redux has a great minimal API
Fred Daoud
@foxdonut
Jul 06 2017 15:29
I've tried React, Preact, InfernoJS, Mithril, Snabbdom. They are all good, each has their "sweet spots".
Pardon the bad analogy but it kind of makes me think of Linux distributions :D all based on the same core idea (virtual-DOM), each with their special sauces.
devin ivy
@devinivy
Jul 06 2017 15:31
it's all how you use it :) i've seen a lot of cringy stuff out there using react and redux. but its because developers are learning how to create live UIs en masse. it's really a hard problem that we're not used to solving.
the tools are actually decent starting places
Fred Daoud
@foxdonut
Jul 06 2017 15:31
The way that people have been (ab)using React does not mean React itself is bad.
devin ivy
@devinivy
Jul 06 2017 15:31
in my view, at least
Fred Daoud
@foxdonut
Jul 06 2017 15:32
@devinivy I agree
devin ivy
@devinivy
Jul 06 2017 15:32
:beers:
Fred Daoud
@foxdonut
Jul 06 2017 15:34

When I look at minimal React it's just a virtual-DOM library with optional JSX and some lifecycle hooks (to be used when appropriate, not abused). You could say the same about the other virtual-DOM libs I mentioned.

Just because people have misused and abused React does not mean React itself is bad. If Snabbdom had become popular instead of React, and people were abusing, misusing, piling on libs etc. with Snabbdom, would that make Snabbdom bad?

Jean-Jacques Dubray
@jdubray
Jul 06 2017 15:47
sorry, I didn't mean to start a new thread, happy when people disagree, I respect your opinion, I am just counting how many "things" React needs to actually do a decent job.
devin ivy
@devinivy
Jul 06 2017 15:55
it can be overwhelming, yeah!
do you suggest that the framework approach is preferable?
Fred Daoud
@foxdonut
Jul 06 2017 16:04
@jdubray sorry to harp on this, but again, I don't think you are being fair, in the sense that React is just meant to be a virtual-DOM library. I prefer the "do one thing and do it well" approach, instead of having beasts like Angular. Now, you could instead direct your criticism to Redux -- I think your points are valid there. Further, I would argue that using React as the "view" combined with SAM works great, that's all React would actually need to do a decent job.
In fact, I think this would be a great value-proposition for SAM, how it can manage the data flow for a React application, instead of Redux or any other pile of libraries.
But I know what you are going to say, you tried to tell them, they won't listen. ;)
Jean-Jacques Dubray
@jdubray
Jul 06 2017 16:08
ok, I admit it, though when I used react (base) I felt their programming model was way too opinionated (especially calling APIs) and I am under the impression that everything else that has happened since was to try to go around it, rather than fixing the programming model head on. By comparison, Angular's programming model is far more flexible.
By comparison Angular is a lot more ceremonial than react, but if I had to choose I would vote for the flexible programming model, in the end ceremony is just copy/paste, a broken programming model will kill your project.
Fred Daoud
@foxdonut
Jul 06 2017 16:18
What is broken about React's programming model? (I am interested in your point of view on this.)
To me React is just view = function(model). JSX is optional, else you can use regular JS with e.g. JSnoX. As for the lifecycle methods, I don't use them except in special cases, for example when needing to use a non-declarative jQuery widget.
I'd much rather write regular JS instead of learning a ton of Angular-specific template directives!
Jean-Jacques Dubray
@jdubray
Jul 06 2017 16:32
1/ React is too "reactive", it's very difficult to control how the UI reacts to changes to the model
2/ That makes it very difficult to weave API calls
3/ state vs props, it's too tempting to stash state in the components
Originally, V = F(M) is what really attracted me to React. That was a huge paradigm shift
Fred Daoud
@foxdonut
Jul 06 2017 16:49

@jdubray I agree but only because of the way React is presented, explained, shown how to use in examples, etc.

This is entirely avoided when you stay away from using state, props, setState, etc.

Instead, just use ReactDOM.render(view, element) where view = function(model), model is a plain JS object (your single state object), and it returns the view.

But I understand what you are saying, this is not what is usually presented in React tutorials. I'd say the best practice is to "unlearn" all that and just stick to what I said above.

Jean-Jacques Dubray
@jdubray
Jul 06 2017 16:55
yes, the React practice itself is out of control. I am not sure a lot of people would see the argument for returning to purer form.
Fred Daoud
@foxdonut
Jul 06 2017 17:02
Well I am planning on trying to do that ;)
Jean-Jacques Dubray
@jdubray
Jul 06 2017 18:08
:+1:
Jean-Jacques Dubray
@jdubray
Jul 06 2017 19:55
Sorry I have to laugh, Microsoft will always be Microsoft afterall (a big proponent of the "vertical slice" architecture) https://azure.microsoft.com/en-us/blog/design-patterns-for-microservices/
Jean-Jacques Dubray
@jdubray
Jul 06 2017 23:13
Michael Terry
@formido
Jul 06 2017 23:38
Depends on what we're comparing to I guess
compared to dom manipuation with jquery, react is pure joy to read
and it formalizes streaming state down through a component hierarchy, which is a really helpful best practice to meme out through the developer community
If we're comparing to other reactive paradigms, it has the advantage of having by far the widest support, which is a feature