These are chat archives for jdubray/sam

15th
Feb 2016
Jean-Jacques Dubray
@jdubray
Feb 15 2016 04:31
Michael, I'll check your code later today, but I just wanted to "react" to your last comment which goes straight to what I have been trying to articulate all along, thank you, thank you so much. I was stunned myself. I also want to say that this is coming from TLA+, not from me.
It's hard to imagine how powerful TLA+ is
Michael Solovyov
@msolovyov
Feb 15 2016 05:55
An issue I foresee is the modelPresent method getting too large/complex
Jean-Jacques Dubray
@jdubray
Feb 15 2016 05:56
it can be broken down easily, just like the reducer, the key is to separate action logic from model logic which the reducer couples in Redux.
Jean-Jacques Dubray
@jdubray
Feb 15 2016 07:37
Yes, your code looks correct from a SAM's perspective. As I mentioned before, I dislike "databinding", if you look at my Item list example the view function can do a lot of smart things that databinding can't do. If you wanted to use databinding you would have to parameterize the model to achieve the same behavior, which is not the correct factoring.
As I see it, these frameworks will become a thing of the past, it's not a critic of your code, but I would argue that with the SAM factoring, vue itself brings very little value.
Michael Solovyov
@msolovyov
Feb 15 2016 17:22
The usecase I run into is working with designers who don't have much javascript knowledge. So I was hoping to adapt the SAM pattern to allow designers to just create the html/css files and then a developer can go in and add the conditionals/data hookups to the html.
Jean-Jacques Dubray
@jdubray
Feb 15 2016 20:30
Yes, that's exactly what I do. I can send you some code samples if you'd like, I just can't share them publicly because the templates I use are copyrighted.
My expectation is that overtime Designers might learn the basics of JavaScript to produce these functional interfaces to their design.
Michael Terry
@formido
Feb 15 2016 21:21
Your article is being discussed: https://news.ycombinator.com/item?id=11104356
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 22:01

Madness! Sophistry and folly! I object! All of this is predicated on a complete misunderstanding of what front-end programming is, how it works and what problems it faces in the field!

I read that entire wall of text called "Why I No Longer Use MVC Frameworks", in which you yelled about how crappy react and redux were before outlining what amounts to little more than an overwrought specification of how they work. You completely misunderstand that half of the point of frameworks is to smooth over idiosyncrasies between browsers, and that the other half of the point is to unify the way a team approaches a problem. You have nothing but contempt for front-end engineering, zero understanding of the problem space and an ivory tower from which to look down from on high without ever getting your hands dirty.

You're so mad that people use JSX/Templates instead of rendering functions without realizing that JSX IS a rendering function, and that React furthermore allows you to further abstract it by wrapping it the lifecycle render function, and as far as I can tell your objection to this is that you maybe would have factored it slightly differently and you really like concatenating strings together.

You're literally outlining Redux while saying Redux is okay but it has a little bit of React on its shoe so it's worthless. Your objection to GraphQL is "how dare the front-end component specify what it's going to be rendering", and your objection to Falcor is "I dunno, seems weird".

And you're speaking with such confidence that you're leading people astray into the wilderness by promising a utopia. But as evidenced by your debate with Rob above, you admittedly don't write code for a living and have zero understanding of why people would use React.

So what's going to happen is a bunch of people are going to read this, implement their own half-baked implementation of React/Redux, bask in the glory of not having had to rely on a framework and then moving onto their next job while leaving a steaming pile of spaghetti for someone like me to inherit.

You wanna experiment with specifications? Awesome! But don't write a blog post about why you don't use MVC when the answer to that question is that you don't write code for a living, because god help us people will listen to you!

Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 22:09
For the record, I like your architecture! It has the best parts of redux (canonical source of truth, message-passing for updates, cascading view updates) and erlang (nap function to iterate states in your model), and I think you could do a lot of good with it. But to publish in this way, with no understanding of the things you're tearing down, is a huge mistake and sets you up as a destructive iconoclast rather than someone contributing to the field.
Jean-Jacques Dubray
@jdubray
Feb 15 2016 22:09

Not much to add, it looks like you didn't read the article that well since you explain:

without realizing that JSX IS a rendering function

That's actually what I say in the article, that's all it does, everything else React does is complete crap from a bunch of kids who have no idea what they are doing, and have way too much time on their hands.

I am expecting that a lot of people who are emotionally and/or financially attached to "frameworks" will push like you are. The first phase was, let's ignore this guy, we are now entering the second phase, let's fight this guy... I'll patiently wait for the day you use SAM...

Is that you idea of building front-ends? https://www.youtube.com/watch?v=mubbsC-zIew
You have no chance... React is dead already, Facebook killed it.
Michael Terry
@formido
Feb 15 2016 22:11
@mbilokonsky Iconoclasm is essential to a healthy culture. Blind conformity leads to dead ends.
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 22:11
This isn't about chance, this is about every server-side hack with a chip on his shoulder insisting that front-end engineering is an implementation detail. You've failed to address any of the arguments for choosing something like React or Angular. Do you think people aren't smart enough to say "Wow, I could just write a pure rendering function?" and stop there? Do you not realize that there are good reasons for standardizing behind uniform approaches when building things that tens or hundreds or even thousands of people will be contributing to?
Jean-Jacques Dubray
@jdubray
Feb 15 2016 22:11
@mbilokonsky this is not "my" architecture, I made it really clear that all I did was to put together the best part of react.js and TLA+, nothing in SAM belongs to me
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 22:12
I don't object to your architecture, as I said I like it - but you're swaggering in knocking over shit you don't understand and implying that people aren't smart enough to do things your way
Jean-Jacques Dubray
@jdubray
Feb 15 2016 22:13
Again nothing I say is "my" way, it's the TLA+ way, a very proven formalism that was rewarded by a Turing award
Compared that to Redux, a kid in his dorm cook up a ball of mud, builds a story around it and everyone follows
brucou
@brucou
Feb 15 2016 22:13
I have to step in here again, as those claims are as tiring as they are false
Jean-Jacques Dubray
@jdubray
Feb 15 2016 22:13
Is that what you are talking about?
brucou
@brucou
Feb 15 2016 22:13
SAM is not TLA+
Jean-Jacques Dubray
@jdubray
Feb 15 2016 22:13
Sure
brucou
@brucou
Feb 15 2016 22:13
ask Leslie Lamport, he won't tell you otherwise
There are a substantial number of claims and name dropping behind made here, and there will always be people who will get fooled
but the good engineers will know best. Whoever wants to experiment with stuff, go on, you learn from every thing.
Jean-Jacques Dubray
@jdubray
Feb 15 2016 22:14
I sent him and email with a pointer to the article and he told me he'll reply to me in the second half of Feb.
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 22:15
Why are you sitting here insulting Dan, who is one of the kindest, most open, most thoughtful and most interesting programmers in the field today? He had a good idea, and he wrote it up. And a ton of people found it really helpful! And you're sitting here getting bitter about that, calling his innovation of a ball of mud and implying everyone else is just being fooled. Seems to me that you're just bitter at someone else's success.
Stardrive Engineering
@HighOnDrive
Feb 15 2016 22:16
I'm interested in dataflow and pipelines these days so if there is a magic pattern I am all over it and would consider it along with others. In my world of Cycle.js and RxJS and Functional Programming there are a lot of new ways being discovered.
The MVI pattern described at cycle.js.org and also drivers to handle side-effects are two important innovations. Then there are Observables, which bring further innovative thinking to how a reactive loop pattern is formed.
So, I'm looking for the best wisdom from all these sources and I my only wish is that I did not have to piece all these sources together myself, but hey, such is the opportunity before us.
Jean-Jacques Dubray
@jdubray
Feb 15 2016 22:16
Dan has declined to answer any of my requests to talk for the last couple of months.
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 22:17
Dan went from being a kid in a dorm room to one of the biggest rock stars in programming over night, you think he has time to answer every request?
If your writing and attitude here is any indication you probably sent him a really condescending message and he had better things to do, but that's just my inference.
And anyway it doesn't justify sitting here shitting on him
Michael Terry
@formido
Feb 15 2016 22:18
Does anyone here have any substantive criticisms of SAM? So far all I'm seeing is tone complaints and "that's not TLA+" with no specific dispute.
Clemens Akens
@clebert
Feb 15 2016 22:18

@jdubray Thank you for your interesting article.

I'm a bit confused, in your article, you wrote:

"In SAM, A (actions), vm (view-model), nap (next-action predicate) and S (state representation) are and must all be pure functions."

But here on gitter you wrote:

"3rd party APIs should be called in the actions since their purpose is to compute the dataset to be presented to the model"

According to my understanding a pure function does not cause any side effect, like a 3rd party API call.

a 3rd party API call as in a function that takes in a request and returns a response would be pure
"3rd party APIs like getPostalAddress({street: , city: , zip:})"
getPostalAddress would be an example of a pure function
Clemens Akens
@clebert
Feb 15 2016 22:24
@mhr ok thanks, i have mistakenly equated "3rd party API" with "Remote API Call"
brucou
@brucou
Feb 15 2016 22:37
I want to emphasize how the claim game is easily played. I can say SAM is not TLA+, and he said it is. He said, she said. There is no formalism here to prove any assertion. We are into the field of advertising/evangelization/communication not into computer science and programming. So some people resort to this <drop a famous name> here talks to me - trying to induce people in believing that they have been recognized by the serious guys. But nothing like that happened. There is no support WHATSOEVER of Leslie Lamport in anything related to SAM. There has just been some discussions of the kind we are having now and that was not even that much. But this is not the story we hear. Little facts, lots of unsubstantiated assertions. Claim of big revolutions, little code to make a case for it. When the influential guys don't pay attention, the cheap trick is to denigrate them (through claims, again, no arguments, no examples). The whole thing of the outrageous claims can also be seen as a cheap trick to get attention. It worked, people are writing code, and taking advice about unknown characters about how they should write their code - and that unknown character does not write code for a living while positionning himself as an expert - or validated by experts (SAM is TLA+ argument).
The good thing is that time will put every thing in the place it deserved.
Michael Terry
@formido
Feb 15 2016 22:41
I only care about ideas
Don't care about known or unknown characters
Never heard of TLA so that's not a big selling point
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 22:41
If you want to use the bulk of these ideas in production today without causing problems for anyone just go write Redux code, is the TLDR on this as far as I can see.
Lamport himself could materialize and say "YES SAM IS THE IMPLEMENTATION I'VE ALWAYS DREAMED OF!" and it wouldn't invalidate any of the concerns from any of the people who work in front-end engineering roles every day and who say that this entire approach misunderstands the problems they face.
brucou
@brucou
Feb 15 2016 22:44
@formido good. But there are two things. What is SAM? Then what problems does it solve which other frameworks do not solve? Andthat's up to the author to answer those two. The first question is not clear, which makes the whole thing hard to debunk precisely as it is not defined precisely. The second is easier to answer to as it is more specific. But again, the burden of proof is on the claimer.
So when the claimer says SAM is TLA+, then my critic is SAM is NOT TLA+. And that's the end of it. If your claims are based on a series of assertions and the first ones is wrong, there is no need to prove/disprove the rest
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 22:47
whereas my criticism is that I liked these ideas when they were called Redux and didn't promote themselves by tearing down everything they don't understand and calling everyone an idiot. :P
brucou
@brucou
Feb 15 2016 22:48
if you write formulas that look like mathematics, with functions which you claim are pure functions, and they are not, and you insist they are, then that's that.
If you claim that present is a key part of your architecture because of actions reuse, and you can't articulate why actions reuse is so important, then it stays a claim. Examples can easily help clarify this, but I have seen none. Only the claim.
brucou
@brucou
Feb 15 2016 23:03
And so on and so forth. I spent time analyzing these 'ideas' before reaching my conclusion, I produced my own charts, a code sample using RxJS for the wiring, after trying to understand the horrible code which has been submitted as an example. I made my conclusion, others will make there.
brucou
@brucou
Feb 15 2016 23:09
When I see code that prove my conclusions wrong, I'll happily change those conclusions.
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:10
@clebert the key to understand is that there are two phases that you need to decompose that Redux doesn't, hence my issue with Redux. Redux was cooked up as a patch to Flux without looking at prior art.
Let me illustrate with a simple "counter example"
In redux the reducer updates the model as:
state.counter += 1 ;
All I have been trying to suggest to Dan is that this is an unfortunate coupling, you should write it as:
action increment(value) {
      return value + 1 ;
}
and then present the output of the action to the model:
state.counter = data.counter ;
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 23:14
So you just don't know about combineReducers, which allows you to decompose your model in exactly that way. https://github.com/reactjs/redux/blob/master/docs/api/combineReducers.md
or wait, you're wanting to do the integration on the action?
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:14
The model has all the information for applying the rules that will decide whether the data.counter value can be accepted or not
that model logic will be reusable regardless of the actions applied to the system and the resulting data presented to the model
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 23:15
this is an implementation detail. You can write a 'setValue' action or you can write an 'increment' action
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:15
Of course, just a detail
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 23:15
like literally you can do exactly this with redux
but if you do it this way you lose the replayability story
instead of your state being the reduction of a set of actions, you now have to order your actions and your action creators have to know details about the internals of your model
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:16
Perhaps, but this is not about what you can do, rather what you MUST do, that's quite different. All the Redux examples I see never talk about that.

@mbilokonsky just to be clear, either you don't understand what I am saying or ... This is what "combineReducers" do:

As your app grows more complex, you’ll want to split your reducing function into separate functions, each managing independent parts of the state.

This has nothing to do what I just explains

Please stop making things up, this is not helpful with the discussion.
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 23:18
yeah, I misunderstood, but I think I see what you're saying now and it's considered an antipattern
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:18
You bet...
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 23:18
sorry, you didn't post valid javascript and I got confused
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:18
there is such a thing as "valid javascript"?
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 23:19
nothing but contempt for anyone who writes front-end code for a living and you're dressing yourself up as some sort of javascript messiah
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:19
humor aside, there are two phases that happens an IMHO combining them is the absolute wrong thing to do
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 23:19
it depends on what you're trying to solve for
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:19
SAM does not preclude you to use your favorite framework, heck even Redux
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 23:19
you could have actions that are CRDTs that know how to self-assemble into a coherent state and your reducer is dumb, just integrating actions
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:20
SAM is just a pattern that delineates seek to "separate the logic from the effects" (same as Cycle.js)
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 23:20
but it tends to be easier to maintain when you're converging all of your actions through a well-specified reducer. You don't have a patchwork of computation happening on the remote edges of your application where stuff is harder to maintain or reason about.
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:21
Again, you are free to make up any semantic you want, I am just telling you that I am using TLA+, @brucou disagrees, all the power to him.
I disagree with your semantics and conclusions. Perhaps we can keep it at that? perhaps we are building very different systems, I am building OmniChannel solutions for IT organizations.
The Facebook page is like a Zoo, some I am certain they need all the crap they are building, but please don't tell me that everyone needs it because it is not true.
Mykola Bilokonsky
@mbilokonsky
Feb 15 2016 23:23
I'm saying that you can respectfully decline to use pieces of technology without writing half-baked criticisms of their achievements without understanding any of the problems they're trying to solve. Watch, I'll show you how to do with SAM. Have a nice day!
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:25
Or perhaps it is the opposite? Redux is a half-bake piece of technology based on a complete misunderstanding of what it is trying to achieve that I respectfully (or not) decide to criticize?
in response to @brucou about the claim that it is not, I did spend the last 12 months studying TLA+ and talked to Dr. Lamport about it, who is one of the smartest individual I ever met. Here are the results of my studies:
http://www.ebpml.org/blog15/2014/12/tla/
http://www.ebpml.org/blog15/2015/01/tla-the-die-hard-problem/
http://www.ebpml.org/blog15/2015/01/state-machines-and-computing/
http://www.ebpml.org/blog15/2015/04/star-based-component-model-with-tla-semantics/
Then I wrote a couple of libraries, to implement and test these semantics:
https://bitbucket.org/jdubray/star-javascript/src
https://bitbucket.org/jdubray/star-java/src
What @brucou has to say in return? is that IT IS NOT TLA+
Perhaps he could tell us what is TLA+ then?
and why SAM is not TLA+?
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:33
@brucou you are speechless? That's what I thought

To answer the specific question, what is SAM and what specific problem is solves. SAM is a reactive/functional pattern that separate business logics in 3 broad categories:

  • actions (pure function that prepare the data to presented to the model)
  • model mutation
  • next-action-predicate

To the best of my knowledge (and I am happy to be wrong) I don't know of semantics other than TLA+ that separate business logic that way.

In doing so SAM allows architects and developers to "weave" API calls (3rd party APIs in actions and CRUD APIs in the model)

In traditional MVC or even Redux all these concerned are mashed up, for instance the controller code would look like this (just imagine real code...):

outputs = A(inputs)
model = model.update(outputs)
nextView = S(model)
action = nap(model)
action(model)
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:38
Again, really simple SAM helps developers and architects make the right decisions as to where to position business logic and API calls. That's the value proposition of SAM
Michael Solovyov
@msolovyov
Feb 15 2016 23:40
There's no need to get hung up on the particular implementations. The pattern really helps out backend developers work more independently from designers. My issue was the messy string concat frontend portion. But I've just used a view library for that instead.
Stardrive Engineering
@HighOnDrive
Feb 15 2016 23:42
@mbilokonsky "you could have actions that are CRDTs that know how to self-assemble into a coherent state and your reducer is dumb, just integrating actions", now you're talking!
From this crazy thread I just clued in to what it is my own pattern does, it replaces redux reducers with a configuration that self-assembles reusable functions, even more superior because it's a softwired solution too
Stardrive Engineering
@HighOnDrive
Feb 15 2016 23:51
I guess just building a real world larger app teaches you the right things. The best might be to be okay with everything just being half baked and then being prepared to bake the other half yourself. Regardless of what I knew all along I am still open learning during this station identification period I'm presently in.
Jean-Jacques Dubray
@jdubray
Feb 15 2016 23:52
3rd party apis have no effect on the model, they enrich data presented to model