These are chat archives for jdubray/sam

27th
Jun 2016
Fred Daoud
@foxdonut
Jun 27 2016 00:30 UTC
@jdubray with all due respect, JJ.. while I agree with your views, I have to say that the few times I've come across threads of conversation between yourself and people from the Redux community, I think you are going about it the wrong way when you try to convey your message to them.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 01:39 UTC
I understand, I don't think there is much of a discussion possible anyways.
For them SAM is just Redux, but poorly used, there is no room to discuss the semantics of Actions, Reducers, the separation of Proposals from Acceptors, next-action vs Sagas, ...
Jean-Jacques Dubray
@jdubray
Jun 27 2016 01:45 UTC
Even when some people complain about Redux not being scalable both in performance (immutable model) or functionally (as the code base grows), the Redux community would not discuss with them.
Fred Daoud
@foxdonut
Jun 27 2016 01:47 UTC
That's a shame, really.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 01:51 UTC
You'll notice that the React architecture is out of control, how many redux-xxx library do we have? 30? 50? This tweet just came out:
https://twitter.com/YassineElouafi2/status/747234347485380608
I'll focus my energy on Angular2, React has become a hipster community, a community where saying anything negative triggers the instant response "you just don't get it".
Jean-Jacques Dubray
@jdubray
Jun 27 2016 01:58 UTC

I think this quote sums it all:

The looseness with which React can be employed is great for experimentation, but challenging when you're trying to do things the right way. Knowing there isn't one yet will save you some time here.

Everyone I have seen adopting React is because it was cool (including me last year) and promising (V = f(M)), but again, it is out-of-control today and I'd be curious to know, which team has not experienced a hangover after a few weeks of Reacting.
Fred Daoud
@foxdonut
Jun 27 2016 03:06 UTC
This is where you confuse me. I would think you'd say Redux instead of React. There is nothing stopping you from using just React as a view library while using SAM for the rest.
But I'm sure you know that already. Maybe it's me who misunderstands. Perhaps you mean the React community, which inevitably includes many people that also use Redux.
Personally I still prefer React over Angular2. Actually, with Meiosis, the view library is a matter of preference, but either way it ends up being just the view. Angular2 is still overly complicated, complex, and still is too large of a framework, IMHO.
Dependency injection is the biggest flaw in both angulars.
devin ivy
@devinivy
Jun 27 2016 04:01 UTC
react is cool but it's notoriously hard to have a performant rerender without something like immutable.js. this is probably the same across all vdom-esque solutions. i still follow polymer since it provides a general-purpose API for component property changes.
not to mention that it's building off web standards. it's betting on the long-haul for sure... and i would still definitely reach for react when it comes to mobile interfaces thanks to react native.
Edward Mulraney
@edmulraney
Jun 27 2016 11:53 UTC
@foxdonut completely agree with everything you said. With respect, @jdubray's approach to promoting SAM actually slows down its adoption. This is frustrating because there's good content in SAM but it's not being conveyed
Riccardo
@riccardoferretti
Jun 27 2016 12:03 UTC
@jdubray I find the distinctions around semantics that you talk about above very interesting but it’s not quite clicking for me yet - are there resources to dig a bit deeper in them?
Fred Daoud
@foxdonut
Jun 27 2016 12:08 UTC
@edmulraney Exactly. It took me a while to get SAM. I got frustrated and almost walked away. JJ, very much to his credit, remained patient and did not give up on discussing it with me. However, to really understand it clearly, I had to go thru some examples several times, writing diagrams on paper, scratching things out, drawing arrows... until it finally made sense to me. Now, it does not seem complicated at all, but we definitely need more/different approaches to explaining it if it's going to reach a wider range of people.
Yes, it's important to explain the theory behind it, and SAM is a pattern, not a framework, but there is a significant number of people who simply will not be motivated to look into it without showing some code that demonstrates why "this is better". When I was writing for The Pragmatic Programmers, this was a very important principle. Start right away with a code example, grab the reader's interest. Then you can take a step back and explain the theory.
Fred Daoud
@foxdonut
Jun 27 2016 12:15 UTC
Not by any stretch of the imagination am I an expert on today's mindset, but it seems to me that these days, you have very little time (140 characters, perhaps?) to get someone's attention. Even just a few lines of code saying "with SAM you could solve it this way" might reach people. Of course, this is not a "copy paste this code without understanding it" situation! More like, "that looks cool, let me go there and find out more about it..."
Jean-Jacques Dubray
@jdubray
Jun 27 2016 13:10 UTC
@foxdonut The problem with React is that it is sold as a mere library when in fact it is an "open" framework without much direction. So I tend to speak of React as React+Redux, because Redux corrects a number of semantics of React alone. In essence it is easier to add a library to React than discuss the semantics of its programming model.
Fred Daoud
@foxdonut
Jun 27 2016 13:23 UTC
Redux corrects a number of semantics of React alone
What, specifically, are the problems with the semantics of React alone?
In Meiosis, by the way, I use React as just a view layer, to implement V = f(M). The "proof" of that is I have an example with React, Snabbdom, Mithril, jQuery/Handlebars, and vanilla JS/plain HTML strings all acting as view layers. All the other code remains unchanged -- only the view layer is swapped with one or the other of these view libraries. React is no different than the others, it just provides the view. The difference is just in the details of what each library gives you to construct views and respond to DOM events.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 13:30 UTC
The problem of React alone is that you have to use the components' lifecycle to weave your business logic. In that context, weaving API calls in React components was a complete disaster that's why they frantically looked for an alternative Flux / Redux / GraphQL+Relay

I use React as just a view layer, to implement V = f(M)

yes, this is the correct way to use React (and Angular2). A Front-End component model cannot be "Object Oriented"

Jean-Jacques Dubray
@jdubray
Jun 27 2016 13:37 UTC

@edmulraney @foxdonut the react team has reached "pundit" status, they can say whatever they want, it is gospel. Note that Dan has backed down a bit recently and when people press him about the Redux semantics / principles, he tends to say that's just some recommendations. It's really hard to have a dialog with pundits. They will never discuss the facts, it will always be about their "expert opinion". Just ask the UK.

Now that React+Redux has a bunch of pundits, the hipsters have moved in, they want Redux on their resume, for whatever that means. At that point the balance between pundits/hipsters is very hard to shift towards more factual discussion.

@riccardoferretti Semantics are very difficult to convey because they represent a shared understanding, what I think is conveyed precisely with what I say and is exactly understood by you the same way.
Fred Daoud
@foxdonut
Jun 27 2016 13:38 UTC
The problem of React alone is that you have to use the components' lifecycle to weave your business logic.
I agree. I do not like component lifecycle methods. I find the need for them is a bad sign, except perhaps in some very few specific cases - focus(), for example.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 13:40 UTC
Yes, that model was inspired by iOS programming model (which I know very well since I was a NeXTStep programmer for 7 years) and then built mobile apps for about 3 years.
That model was never, ever designed for an "API" world.
or distributed system view of front-end architectures
That's why it is so important to focus the discussion on semantics
I have all the patience in the world for good/open discussions
Riccardo
@riccardoferretti
Jun 27 2016 13:41 UTC
yeah @jdubray, I agree :) to @foxdonut point earlier, some code samples that illustrate how different semantics (right and wrong) are used might help to explain them
Fred Daoud
@foxdonut
Jun 27 2016 13:42 UTC
I find it easier to use React as V = f(M) than Angular2. @jdubray perhaps you can share your experience with using Angular2 as just a view layer. I found it overly complex since A2 isn't really designed for that, it's more of a large framework meant to take control over everything happening in the UI.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 13:42 UTC
@riccardoferretti The problem in software engineering is that we have two core semantics: functions and data structures. Everything else is somewhat a random assembly or poor variant of these semantics
Even something as simple as "what is an action?" would generate north of 10 different answers within a group of people.
I was stunned when I had this discussion on one of the redux issue board, I asked to clarify the distinction between event/intent/action
Even that could not be discussed properly.
As I mentioned code is not necessary the best way to discuss semantics because all people see are functions and data structures.
You have to discuss semantics outside of code, you might even end up with a different implementation for the same semantics.
Fred Daoud
@foxdonut
Jun 27 2016 13:47 UTC
@jdubray I understand what you are saying about the community. I've seen it in Cycle as well. Some things are difficult to discuss because the experts have already decided what is right and what is wrong, and they are not always open-minded about discussing the possibility that they might be wrong, or that there might be a better way.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 13:48 UTC
You also have to discuss the semantics one-by-one and in order. For instance I purposely kept events and intents out of SAM because I feel they are outside the pattern.
@foxdonut yes, it's not even a question of right and wrong. Redux is not wrong. There are just implications as to the semantics you choose.
Fred Daoud
@foxdonut
Jun 27 2016 13:49 UTC
The problem also arises when some people have had reasonable success with what they are using (React+Redux), they feel comfortable because they understand it and can "get things done" with it, it is very hard to convince them to consider another way of doing things.
it's not even a question of right and wrong
Jean-Jacques Dubray
@jdubray
Jun 27 2016 13:50 UTC
Yes, absolutely, that's why it's best to not go the right/wrong direction, but point at the imprecision of the semantics
Fred Daoud
@foxdonut
Jun 27 2016 13:50 UTC
Yes, I'm not using the proper words here.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 13:50 UTC
semantics...
Fred Daoud
@foxdonut
Jun 27 2016 13:50 UTC
lol
Riccardo
@riccardoferretti
Jun 27 2016 13:50 UTC
haha
Jean-Jacques Dubray
@jdubray
Jun 27 2016 13:51 UTC
In the end, we should just be careful as to how much boilerplate code a set of semantics require
Fred Daoud
@foxdonut
Jun 27 2016 13:51 UTC
add the fact that discussions are online, where you can't always get the tone of the other person, etc.. and :boom:
Jean-Jacques Dubray
@jdubray
Jun 27 2016 13:51 UTC
The problem I see, say you use React (without Redux) semantics, they you have to write tons of boilerplate code do deal with APIs
It often looks inextricable, that's when you know your semantics are not correct.
Another example, I lived and breathed Petri Nets for most of my career, say 25+ years, until I found TLA+
For 25+ years I felt there was no other way to think about a State Machine than in terms of tuples like (S0,A,S1)
Fred Daoud
@foxdonut
Jun 27 2016 13:53 UTC
But, I'll give you one example. Several people, including myself, don't like one of the ideas in Cycle where you use CSS classes and/or attributes in the DOM to know which button was pressed. But whenever that concern is voiced, it is met with "nope, there's nothing wrong with that" and "this keeps everything pure" responses.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 13:53 UTC
It was very convincing, you are in a state, you apply an action, you get in another state. What else there is to it?

"this keeps everything pure"

yes, that's when you know there is a semantic problem

that's the kind of sign you should look for. Then you know something doesn't quite fit
Just like State Machines, you go and try to apply it at scale, it works well for simple things, but at Scale it does not really work, but you can't pinpoint that wrong.
Fred Daoud
@foxdonut
Jun 27 2016 13:55 UTC
This is where I question my own understanding of the word semantics :D
Jean-Jacques Dubray
@jdubray
Jun 27 2016 13:55 UTC
That's when you have to go back at the semantics level, something is missing, most certainly it is the same for Cycle.js
Semantics = the meaning of something. What do you mean when you say the word "Action" or "State"
As I said, in software engineering we have only two semantics that are widely understood, functions and data structures. Every combination/variant becomes something you have to create a shared understanding for
is an action a function? well, it's a variant of a function, it's not just a function. It's connected to other things in a very precise way.
You will note that every framework come up with their semantics (Elm: signals, tasks, commands,...), Cycle.js (Streams, Drivers, ...)
It's ok, they may well be better semantics than SAM, I'd be the first one to recognize it, I am just asking to be careful and deliberate in the ways we create semantics. It's not that simple and it has broad implications in the work of 10s to 100s of thousands of people.
OO being possibly the worst semantic mistake of our industry
Look at the semantics of JavaScript, they are amazing, compare coding in Java vs JavaScript.
Fred Daoud
@foxdonut
Jun 27 2016 14:04 UTC
Yes, that makes sense to me.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 14:04 UTC
You may find it interesting/amusing that in Redux, Dan didn't start defining an action from a function, but from a data structure... All these choices are non trivial and the result is that the code of the action you would normally write in a function, you would have to push it in the reducer.
That's really the kind of discussion we should all push, objectively, honestly, openly.
Semantics discussions are the most difficult discussions to have with pundits and hipsters, because they push their "expertise" as a limitation of your understanding.
Fred Daoud
@foxdonut
Jun 27 2016 14:19 UTC
Absolutely spot on.
As you said, "action" is probably the most difficult. Even in SAM: consider the simple counter example.
The user clicks on the + button. That is user intent -- the user wants to increase the counter.
The DOM emits an event -- our code can respond because we can attach listeners to DOM events.
Now we want to translate that to an action -- "increase the counter by 1".
But in SAM, is that really an action? Because that code doesn't increase the counter by 1. It proposes to the model, "increase the counter by 1". The model is what actually performs the action of increasing the counter by 1, by mutating the model. Further, the action itself does not "increase the counter" because the model could very well refuse the proposal, and do nothing.
Fred Daoud
@foxdonut
Jun 27 2016 14:27 UTC
Further, what if the action isn't just "increase the counter by 1", but instead, the action actually does something like post a request to a server? Then that really is an action. Upon getting a response from the server, the action then proposes something to the model based on the server response.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 14:52 UTC

@foxdonut

The model is what actually performs the action

no, that's the paradigm shift that needs to happen, an action does not decide of the final state. We think it does, it feels like it does, at a very high level, but it is the system which decides the final state

When you go to your favorite coffee shop and you ask for a paper cup and a ceramic cup.
Now let's say you apply the same action, you press on the top of the cup with force X Newton
You "apply" the exact same action
yet, the outcome is very different, they system (the cup) decide the final state.
The paper cup will be crushed, the ceramic cup will not.
SAM's actions as "actions" they are not "functions". They can be implemented with functions but the semantics of a SAM action is very different with the one of a pure function.
Fred Daoud
@foxdonut
Jun 27 2016 14:56 UTC
an action does not decide of the final state, the system which decides the final state
I see. So, continuing on this. If the action is "press on top of the cup", either way you are performing that action. The system (or model) decides the outcome (crushed cup, no effect on cup).
What is a better way of describing the action, "increase the counter"? In a way that you are not actually increasing the counter, because the system/model ultimately decides on the outcome, i.e. whether the counter will or will not actually be increased.
@jdubray I like where this is going, I think it will help understand and explain SAM.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 16:10 UTC
@foxdonut any action that adds something (even to a collection) is difficult to describe as a protocol, is usually write the proposal as {incrementBy: 1} or {addToRecords: record}
The main problem is concurrency, you cannot propose a value to the counter with concurrent proposals, though Praxos handles that case very well with the notion of (computer) time (not absolute time).
Another point to discuss about actions, is who decides whether an action is allowed or not? is it the system or the action itself? You know my answer, but a lot of people would associate "allowed" to validation.
I find these discussions really interesting but lots of people don' t have the patience to discuss them. They'd rather start with a very basic concept such as function or data structure and then resolve the semantics in code. Not the best approach IMHO.
Fred Daoud
@foxdonut
Jun 27 2016 16:16 UTC
@jdubray I'm with you. So that's what I'm wondering, in some cases, is an action actually not an action at all, but rather, a proposal?
Jean-Jacques Dubray
@jdubray
Jun 27 2016 16:16 UTC
Imagine if we had a meeting of the top framework to discuss their semantics. It does not mean that we have to all agree, but in the end everyone will be a lot richer and more robust.
with respect to "what", what if the true nature of an action would be to create a proposal, everything else would be an approximation, not wrong, but an approximation that is true in some cases only?
for instance Redux's Actions as data structures look a lot like proposals to me
Fred Daoud
@foxdonut
Jun 27 2016 16:17 UTC
I agree with you on allowed actions vs validation. The system/model decides allowed actions e.g. coffee cup is full -> not allowed to add more coffee. Validation, instead, is more along the lines of "how many mL of coffee do you want to add to the cup" -> user enters "abc" -> validation is "abc is not a valid number of mL"
Jean-Jacques Dubray
@jdubray
Jun 27 2016 16:18 UTC
but the downside of Redux's basic model is that you cannot "compute" a proposal, the proposal has to be readied by the event/intent. Not the best choice if you ask me.
Why is it impossible to have such a simple discussion with the Redux community?
Fred Daoud
@foxdonut
Jun 27 2016 16:19 UTC
Indeed!
Jean-Jacques Dubray
@jdubray
Jun 27 2016 16:19 UTC
Take Lee Byron's proposal (immutable.js) of what an action is:
blob
At a very very high level, that is what an observer could "see" I start my car and the car get started, somehow.
Fred Daoud
@foxdonut
Jun 27 2016 16:20 UTC
If you "forget" to validate, the model might also validate, i.e. reject a proposal of "add abc mL of coffee to the cup" because "abc" is not a valid amount. but that is still different from allowed actions. When the cup is full, adding coffee is not an allowed action, regardless. That might result in disabling a UI control, for example.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 16:20 UTC
That's conflicting with Redux's view of what an action is.
Yes, precisely, the model can still reject an allowed action
those are very important questions, they have huge impacts on maintainability of your code, reuse, ease of writing, testing...
Fred Daoud
@foxdonut
Jun 27 2016 16:21 UTC
Exactly. Even a "valid" proposal, "add 500 mL" might be rejected because the cup only has room for max 100 mL more of coffee.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 16:21 UTC
Ultimately, the programming model should provide the right hooks to articulate business logic.
yes, the "action" of pouring coffee into the cup cannot "getState" of the cup, it's very difficult for an action to "know" the state of the system.
Fred Daoud
@foxdonut
Jun 27 2016 16:22 UTC
So it comes back to my original question. Should we even say "action" when "proposal" might be more accurate?
Jean-Jacques Dubray
@jdubray
Jun 27 2016 16:22 UTC
Unfortunately we have decades of OO that create a bias that I can "getState" at any time.
Yes, you can, but you pay a huge price in maintainability of your system when you do that.
I would not change the term "action", I would simply define the semantics of an action (following TLA+) and say anything else is not an action. Redux's "actions" are not actions, Lee Byron's actions are not actions
Their point of observation was wrong, in some cases or at a high level the observer can be lead to believe that's an action, but we have a more general definition that covers their definition.
The problem is people will see simplicity in their definition, so it can't be wrong right? one is a data structure (Redux), the other one is a function (Lee Byron)...
See we are so biased towards functions and data structures.
The semantics should give you enough structure to write your code, each time you want to write a business rule, change some application state, deal with side effects, .... the semantics should be here to answer these questions.
Fred Daoud
@foxdonut
Jun 27 2016 16:27 UTC
My problem with "action", even if you precisely what an action is (a proposal), is that it goes against the very meaning of the word. action implies a verb, do something. It's dangerous to confuse that with "increment the counter". The "action", what you are doing (verb) is actually to propose to increment the counter.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 16:27 UTC
For instance you could argue that the GoF patterns exist only because OO semantics are so broken that you need a layer of pattern to guide the average developer to do anything.
Well the "Step" in SAM, triggered by an action is to actually "do something"
Once you trigger an action, the outcome is a proposal to the system, and the application state will generally be mutated
I would not get caught up in words, there is a difference between words and semantics. In a given context, a word is just a label to some semantics. There is no way around it, when we speak we cannot bring enough precision.
Consider the word "design" , it is both an "action" with a clear outcome, and an a label for the outcome itself ( "a" design)
As long as we agree what to design and a design mean, we are good. It's the same for action.
Trying to find another word would be even more confusing, I think
Fred Daoud
@foxdonut
Jun 27 2016 17:15 UTC
@jdubray Good explanation, that makes sense!
Fred Daoud
@foxdonut
Jun 27 2016 17:26 UTC
thank you
Jean-Jacques Dubray
@jdubray
Jun 27 2016 17:42 UTC
thank you!
Nivani
@Nivani
Jun 27 2016 17:56 UTC
@jdubray I am following the discussion here a little bit. Arguing that "GoF patterns exist only because OO semantics are so broken" seems extreme. I would say that functional programming greatly simplifies a lot of the patterns. My feeling is that it's also true the other way around: that OO simplifies patterns necessary to handle programming in purely functional languages.
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:00 UTC
Ok, it's a bit extreme. I was trying to illustrate the amount of boiler plate code you need when the semantics are broken. That being said, I'd be curious to see the number of patterns that you no longer need when you switch from Java to JavaScript?
Michael Terry
@formido
Jun 27 2016 18:11 UTC
I would not get caught up in words, there is a difference between words and semantics.
it's a problem that you think this
words are how we communicate semantics
fine-tuning the words is incredibly important for other people understanding
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:12 UTC
Do you have an alternative? we have a finite number of words. Creating a neologism is not always the best approach
Michael Terry
@formido
Jun 27 2016 18:12 UTC
you're not just choosing random words in the first place, and for good reason, because then your message would be literally incomprehensible
yeah, nail down the terms
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:12 UTC
Of course, but it is a common practice to choose the same word for slightly varying semantics
Michael Terry
@formido
Jun 27 2016 18:13 UTC
define exactly what YOU mean by the terms
earlier you were making fun of the fact that people would have 10 different ideas of what an action meant
I expected you to immediately give your definition
but you didn't
and that's a common theme in your writings
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:13 UTC
It's a fact, not so much making fun of it.
Michael Terry
@formido
Jun 27 2016 18:14 UTC
I'm intrigued by SAM
I wrote a script yesterday in which I tried to use SAM principles
but you have a messaging problem
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:15 UTC
The problem is the context in which you express these semantics, you can't use words in vacuum.
Could you elaborate?
Michael Terry
@formido
Jun 27 2016 18:17 UTC
The vocabulary for this domain has a lot of ambiguous terms
and you're outraged about the bad semantics
but semantics are understood by the vocab
if you want us to understand the right semantics
for any context
you have to keep on defining the precise semantics and linking it to a term
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:18 UTC
I am not outraged by bad semantics, I am outraged by the unwillingness of people to discuss their semantics
Michael Terry
@formido
Jun 27 2016 18:19 UTC
this has to happen over and over for terms where the vocab is in competition in the wider community
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:20 UTC
yes, but semantics are about forming a shared understanding, "shared" is as important as "understanding"
Michael Terry
@formido
Jun 27 2016 18:20 UTC
right, and shared depends on making sure to pick the right word that makes that shared understanding possible
it's hard, but you can't really say, don't think about words too much
you might think like that, but most of us don't
words are very close to semantics
for example
you said actions had precise semantics
I don't know what those precise semantics are still
not just a function apparently
what other form can an action take
that is still precisely the semantics you intend
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:22 UTC
Redux's action are a data structure
Michael Terry
@formido
Jun 27 2016 18:23 UTC
any others?
how do you propose a data structure without a function?
I haven't used redux
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:23 UTC
what you are missing is that an action is a function that translates an event in a proposal that it presents data to a model, ... an action IS-A function is not precise enough.
you should ask Dan Abramov, but his initial definition (and mostly used) is a data structure
As I said, in software engineering everything is either a function or a data structure or a combination of both.
Michael Terry
@formido
Jun 27 2016 18:25 UTC
isn't your favored action return type a key/value also?
so a data structure
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:25 UTC
I'd like to argue that, that conceptual foundation is incomplete you also need states and relationships (STAR).
Michael Terry
@formido
Jun 27 2016 18:25 UTC
since an action can only propose a mutation
it's always a data structure
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:26 UTC
You cannot reduce semantics to an IS-A definition
my point, you also need relationships and sometimes states (as in SAM states)
This is the foundation of semantics (IMHO)
blob
You cannot define semantics with a smaller conceptual foundation such as a single relationship (IS-A) and just Type/Action (~function)
I don't want to start the debate which was first, the action or the function, I am ok to say that function is the most basic concept. We could take the other point of view that a function is a specialized action.
I don't want to take this debate too far. I am just trying to point out that these discussions are important and formulating a shared understanding is not easy.
Michael Terry
@formido
Jun 27 2016 18:31 UTC
I'm not trying to claim all functions are actions or anything like that
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:31 UTC
Once there is a group big enough that agrees on a shared understanding then we can create a definition
Michael Terry
@formido
Jun 27 2016 18:31 UTC
I just want to know what the precise semantics of an action are
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:31 UTC
an action is a function that translates an event in a proposal that it presents data to a model
Michael Terry
@formido
Jun 27 2016 18:32 UTC
so not the result of the function, the function itself
is what you would prefer?
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:33 UTC
yes, that's what it is. Now, as an observer, you could find a family of action where the function is identity and therefore conclude that the action IS-A result
Let's say if 99% of the actions were like that, you could even create a different concept for the 1% left.
But I would argue the vast majority of actions are functions different from the identity function
When you pick the wrong semantics then you push these semantics down the pipe, in the case of Redux, an "action" as a function is implemented in the reducer.
Michael Terry
@formido
Jun 27 2016 18:35 UTC
I would gather that redux's "action creators" that people mention often are your actions
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:35 UTC
Should actions be coupled? probably not. There is no action pour and drink attached to my cup of coffee, and pour and drink no nothing about each other.
Yes, but it's not satisfactory to have to concepts you can't have Action is X and Action is Y
Michael Terry
@formido
Jun 27 2016 18:36 UTC
not satisfactory how?
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:36 UTC
That the absolute fundamental problem in software engineering, developers need to pick constantly the underlying semantics of their code. We must help them with enough guidance and the least amount of constraints.
Michael Terry
@formido
Jun 27 2016 18:37 UTC
isn't it one concept and two different terms?
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:38 UTC
kind of the other way around, one term two very very different concepts (one is a data structure, the other is a function)
The outcome, where when you pick a data structure you end up coding a function in the reducer is very very ugly
Michael Terry
@formido
Jun 27 2016 18:38 UTC
I thought action creators were functions and have the same power as your actions
can make api calls and etc.
no?
this is where terms matter...action as just a data structure is awkward to me
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:39 UTC
looks like it. As I mentioned, Redux is close to SAM, and the Redux community does not want to talk about it because they generally feel I picked on small differences and used different terms

action as just a data structure is awkward to me

of course, to anyone, yet, this is what Dan calls an action. Action-Creators are... action "creators", i.e. they create that data structure which is the action.

Michael Terry
@formido
Jun 27 2016 18:41 UTC
I feel like we should have the least number of vocab and ideas as possible
action plus action creator seems like an unnecessary split
so SAM has that going for it
Jean-Jacques Dubray
@jdubray
Jun 27 2016 18:46 UTC
well, I also use the TLA+ definition of what an action is ...
that's been sanctioned by a Turing Award, if Dr. Lamport was wrong, we'd know by now.
If anyone feel they can find a better definition (bonus point if they get a Turing Award for it), I'll start using it, in the mean time, I'll stick with Dr Lamport's
The Facebook guys (Dan, Lee, ...) are bit like a bunch of people who are learning a new language and they make up meanings as they start learning the words. Just like a foreigner who start using words that are close, but not quite right.
Fred Daoud
@foxdonut
Jun 27 2016 20:36 UTC
@jdubray when an action proposes data to the model, for example, {incrementBy: 1}, what do you call that data? -> {incrementBy: 1}
Jean-Jacques Dubray
@jdubray
Jun 27 2016 21:44 UTC
as I said the "add" operation (increment, add to collection, ...) are a bit of an odd case. It still looks like a proposal to me, since the model is in control of accepting it, but clearly it breaks a the semantics of proposing the exact values you want the model to mutate to.