These are chat archives for jdubray/sam

17th
May 2016
Jean-Jacques Dubray
@jdubray
May 17 2016 16:26
This message was deleted
This message was deleted
weepy
@weepy
May 17 2016 21:34
@jdubray what do you like best React or vue2 ?
Jean-Jacques Dubray
@jdubray
May 17 2016 21:41
Vue2 looks promising, I am for sure strongly against any form of template. React's stateless components are a lot closer to what I like, but the problem with react is that it is just a bit too "reactive", the fact that (component) state changes is what triggers the component to render is ridiculous.
That's in particular why redux is the way it is because you cannot mutate the state one property at the time, so they are forced to pass a copy of the state, mutate that copy and then in one shot refresh the store which triggers the rendering (as I understand it)
weepy
@weepy
May 17 2016 21:47
Why against template ?
Jsx is a bit templatey
Jean-Jacques Dubray
@jdubray
May 17 2016 21:59
Two reasons:
  • templates are interpreters, they rely on a (limited) DSL to get stuff done, you are much better off coding
  • they for the model to conform to the view because you have no way to code some transformation to get the right information to the view
JSX is not a template technology at all, you have the full power of JavaScript to get to the output you need, that's a big difference, JSX is just a nicer way to write JavaScript but it does not hide JavaScript in any way.
Jean-Jacques Dubray
@jdubray
May 17 2016 22:04
When you look at the TODO View components, there is quite a bit of JavaScript that is needed to get to the correct output
With a template you have to make sure your data comes exactly the way it will populate the view, here I just pass the TODOs and the filters and the component decides what to do. One component might hide some, others will show the "filtered" one in a different color. That's really for the component to decide. The application state is really: here are the todos, here are the filters, it should not manage component specific state
It's all a question of code factoring/programming model, all these decisions are not arbitrary, they have a cost down the line.
Jean-Jacques Dubray
@jdubray
May 17 2016 22:17

Redux is using "containers" to decouple the model from the components, but I am not a big fan of this decoupling, I prefer something like the State function which orchestrate the rendering of the view. Containers are part of the "View":

const App = () => (
  <div>
    <AddTodo />
    <VisibleTodoList />
    <Footer />
  </div>
)

It makes react/redux programming model a bit convoluted and of course they don't have a nap() function in the container.

Jean-Jacques Dubray
@jdubray
May 17 2016 23:16
The world was holding its breath for a new language to come, meet Reason
https://facebook.github.io/reason
Fred Daoud
@foxdonut
May 17 2016 23:30
oh great, another language :frowning:
I agree about templating. Each has their own syntax and quirks and in all cases you end up with an anemic toolset. Much better off leveraging JavaScript.
Case in point, as an experiment I used JSX, snabbdom, and mithril for the same views, they are all very easy to use because they are JavaScript, not templating engines.