These are chat archives for jdubray/sam

1st
Sep 2017
Jean-Jacques Dubray
@jdubray
Sep 01 2017 06:51
ouch, what do you like about that discussion? it's scary.
Victor Noël
@victornoel
Sep 01 2017 07:50
that's stupid… components are objects, but they are not any object. what's interesting with components is that they express explicitely what they provide and what they requires to work (while object only express what provide)
components are turing machines.
Victor Noël
@victornoel
Sep 01 2017 08:09
seems he is talking about frontend web components, not components in software design/architecture anymay…
Jean-Jacques Dubray
@jdubray
Sep 01 2017 13:52
yes, perhaps.
Jean-Jacques Dubray
@jdubray
Sep 01 2017 14:04
Components imply an activation model. That's the main difference from a traditional piece of code and a component: COM/DCOM, EJB, Spring, ... angular components. You put a piece of code somewhere and it is "activated" (think lifecycle) by the corresponding framework. The fact that they are an "object" or not is quite secondary, only a product of the prevalance of OOP.
Riccardo
@riccardoferretti
Sep 01 2017 14:07
I was just about to reply to that tweet, but I am not good with the 140 chars constraints :)
I agree with the above (and your other tweet https://twitter.com/metapgmr/status/903614096716709888 )
at a macro level, the state machine adds the separation of the state from the step
and state machines can be built both with OOP or FP principles as guidelines
you can write the "step" function or your action functions in a OOP or FP style
Jean-Jacques Dubray
@jdubray
Sep 01 2017 14:09
yes, exactly, they key is to have this separation state/step, which either FP or OOP are not really good at. My response was about this figure
Riccardo
@riccardoferretti
Sep 01 2017 14:09
I feel they solving different problems
devin ivy
@devinivy
Sep 01 2017 14:09
while they are dual, they also "prime" the programmer with certain ideas.
Jean-Jacques Dubray
@jdubray
Sep 01 2017 14:10
The problem you quickly face in FP is meaningful function decomposition, the problem you face in OO is state decomposition
@devinivy exactly, OOP "primes" developers to think about "things" when they should think about organizing state (model in SAM terms)
Riccardo
@riccardoferretti
Sep 01 2017 14:11
I agree with @devinivy , that's the main thing I like about FP. personally makes my code easier to understand and refactor
Jean-Jacques Dubray
@jdubray
Sep 01 2017 14:12
FP is better because OOP pushes us away from the "true" state
FP is closer to state->step->state
Riccardo
@riccardoferretti
Sep 01 2017 14:12
on top of that, state machines allow to model the system "through time"
(not sure if "time" is the right term there)
FP can be the "step" in state->step->state
Jean-Jacques Dubray
@jdubray
Sep 01 2017 14:13
There was a recent article criticizing "small" functions, that really speaks about the problem of FP, where you are not sure what a step is.
@riccardoferretti yes, but it has to be deliberate, a function is a reasonable way to think about a step, but the problem is that people don't factor function with that concept in mind
Riccardo
@riccardoferretti
Sep 01 2017 14:14
yeah, I would agree with that, in the sense that even the make_tiramisu fn could be semantically correct or not depending on whether it's a single step or not
Jean-Jacques Dubray
@jdubray
Sep 01 2017 14:15
yes, in the end you have step1=ingredients, step2=tiramisu.
Riccardo
@riccardoferretti
Sep 01 2017 14:16
which might be fine if that is the intended semantic
Jean-Jacques Dubray
@jdubray
Sep 01 2017 14:16
The problem is that in programming that delineation is not easy to achieve, developers get quickly lost and they compose functions (or methods/classes) in ways that break the state->step->state paradigm
Riccardo
@riccardoferretti
Sep 01 2017 14:17
right, it doesn't provide extra information about the structure of the overall program, but only of how to describe a part of it. it's agnostic towards it
Jean-Jacques Dubray
@jdubray
Sep 01 2017 14:17
something like beat(beat(eggs), sugar, wine) makes sense
beat is a "step"
Riccardo
@riccardoferretti
Sep 01 2017 14:17
but it's like saying a brick is good or bad because it doesn't expose the architecture of the house
Jean-Jacques Dubray
@jdubray
Sep 01 2017 14:17
but when things are more abstract (less visual/obvious), FP doesn't help at all
yes absolutely
It's just a lot of the discussions you see in programming are centered on the brick
Riccardo
@riccardoferretti
Sep 01 2017 14:18
the issue is more the focus on the brick color or shape, rather than more architecture and physics :)
hehe right
Jean-Jacques Dubray
@jdubray
Sep 01 2017 14:19
A brick is an amazing invention, as you know, but it took a lot more than a brick or two (from a principles' perspective) to build the Colyseum
devin ivy
@devinivy
Sep 01 2017 14:19
ha!
Jean-Jacques Dubray
@jdubray
Sep 01 2017 14:19
Absolutely!!
Not to forget that we are always one "step" away from the Tarpeian Rock...
Riccardo
@riccardoferretti
Sep 01 2017 14:21
and the colosseum could have been made of plastic, that would have not changed the structural principles required to assemble the components into the bigger thing
a step is a pre-fab. an unbreakable piece. the state machine is the architecture that, regardless of how many prefabs you have, how big or small they are, the material they are made with, ... puts them together into a wider system
Riccardo
@riccardoferretti
Sep 01 2017 14:27
I need all of the above in 140 chars :)
Jean-Jacques Dubray
@jdubray
Sep 01 2017 14:27
:-)
This also explain why I am so critical of Redux/Elm is because they do not bring anything to the table in terms of structural principles. They give the false impression that you put a big fat pure function on top of some code and you are fine, this could not be further from the truth. This will become one of the biggest fallacies of computing.
Only second to REST
They tell the developers you can be as sloppy as you want, as long as you use pure functions (curse).
REST = focus on state, don't think about actions
Redux/Elm = focus on actions, don't think about state
Jean-Jacques Dubray
@jdubray
Sep 01 2017 14:33
The RESTafarians were all about, just focus on "resources" actions (verbs) can be ignored
devin ivy
@devinivy
Sep 01 2017 14:37
i assume you would say SAM principles can equally be applied to REST
Jean-Jacques Dubray
@jdubray
Sep 01 2017 15:44
I don't want to say that SAM is this universal, it is not (by far), if it can achieve one purpose is to show that we cannot ignore the sequence S1 -> Step -> S2, and to do so, you don't have to think in terms of Petri Nets at all. I think that has been the problem in the past, programming languages put zero emphasis on mutation, FP's pure functions are just a coincidence. FP focuses on "effects" not mutation, which IMHO is the wrong problem, or at least the concept of "effect" is not precise enough to focus the attention of the developer on mutation.
Otherwise, yes, SAM is applicable everywhere there are "actions" and even today, people are confused with URL-as-an-action. I tried to inject myself in a react-router discussion yesterday, but this is hopeless, people are unable to think outside-the-framework.
Jean-Jacques Dubray
@jdubray
Sep 01 2017 15:49
All I am saying is that once you constrain the problem, there are some cases where action-mutation-state can be optimized, yes, it can be ok to think an action is just a proposal, no need for code (not true for front-end architecture), or it's ok to describe the mutations in a computable way. But you better be sure that's the case before you start going down that path, otherwise you'll feel a huge amount of pain, so will you for instance if you try to apply Petri Nets semantics to the wrong kind of problems.
Jean-Jacques Dubray
@jdubray
Sep 01 2017 15:56
The Redux community will never cease to amaze me (repatch): https://community.risingstack.com/repatch-the-simplified-redux/
Once you take the wrong turn you enter a maze that no one will come out of
Jean-Jacques Dubray
@jdubray
Sep 01 2017 16:04
More and more people are groking the fact that Redux architecture is not quite right, now, without any kind of conceptual foundation, people are trying to tweak the concepts (often just focusing on wiring rather than the programming model).
devin ivy
@devinivy
Sep 01 2017 17:14
@jdubray wow repatch is scary
the only way i can imagine it being okay is if you "dispatch the reducer" in order to simulate the new state, then check and see if it's a valid state.
and if it is, commit it.
otherwise that setup is going to be very painful.
Jean-Jacques Dubray
@jdubray
Sep 01 2017 17:16
:+1:
Jean-Jacques Dubray
@jdubray
Sep 01 2017 17:31
Janne Siera
@jannesiera
Sep 01 2017 17:52
@jdubray a link to that router discusion? You have peeked my interest.
Fred Daoud
@foxdonut
Sep 01 2017 18:01
*piqued :)
I really, really like this talk https://www.youtube.com/watch?v=wcAl0VXYBGE
Fred Daoud
@foxdonut
Sep 01 2017 18:06
@jdubray I don't see you in that discussion, am I missing something?
Jean-Jacques Dubray
@jdubray
Sep 01 2017 18:38
I didn't want to join, I think I just made one reply. Just more signs that people continue to struggle with the react/redux programming model
Fred Daoud
@foxdonut
Sep 01 2017 18:54
I don't see any reply..
Fred Daoud
@foxdonut
Sep 01 2017 20:00
The URL has to be a first-class concern when it comes to state management.
its also an "entity" in your system. U can attach data-fetching requirements to
That is a wrong approach to routing IMHO and what makes routing libraries so much more complicated than they need to be.
A route only needs to map to an action. Just like you said, @jdubray .
Then something as simple as url-mapper will do just fine, or universal-router if you'd like nested routes for convenience.
devin ivy
@devinivy
Sep 01 2017 20:05
can someone summarize their point? i don't fully understand
Jean-Jacques Dubray
@jdubray
Sep 01 2017 20:05
I think "react-router" is becoming the latest wrench du jour in the react world to structure your app.
devin ivy
@devinivy
Sep 01 2017 20:07
in what sense? how are folks leveraging it aside from for showing components based upon the URL?
Jean-Jacques Dubray
@jdubray
Sep 01 2017 20:17
I think in the sense that you can build a full app without or with a minimal number of routes, and people seem to go out of the way now to use routes, but I am not sure.
Fred Daoud
@foxdonut
Sep 01 2017 21:26
@devinivy I think they are doing much more than that, based on the above, for example U can attach data-fetching requirements
Some of these routing libraries are doing way too much, it's evident from how many moving parts you have to align to set them up.
router5 for example, its video demonstration shows this flaw.
In general, to me a dead giveaway for a design flaw in a library is the need to install a somelibrary-react to "connect" the library to react. I was guilty of this myself with my first version of meiosis.