by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    brusand
    @brusand
    Project
    Stardrive ENGG
    @HighOnDrive
    @jdubray Sure, use the quote, cheers!
    Stardrive ENGG
    @HighOnDrive
    If possible give me a preview, thanks.
    Jean-Jacques Dubray
    @jdubray

    @HighOnDrive I was thinking something along the lines of:

    A good Front-End Architecture should allow you to pin your modularized functions to the UI components in the most decoupled way possible. That way the technology backing the components can be swapped out and all your business logic are not in a hostage situation (at the mercy of the next great late framework).

    would that be representative of what you were saying?

    Stardrive ENGG
    @HighOnDrive
    @jdubray Just in from my day, like what you have distilled from the point I was making :+1:
    Maybe change "your business logic are not" to "your business logic is not"
    Jean-Jacques Dubray
    @jdubray
    sure, thank you. Do you want to be quoted as HighOnDrive or with your real name?
    Stardrive ENGG
    @HighOnDrive
    Use my real name, "High On Drive" is the title of a song I wrote for my prog rock band Stardrive Engineering :smile:
    All the bands songs have the "Rocket Launcher" theme :rocket:
    Jean-Jacques Dubray
    @jdubray
    Ah ah... you can't dislike SAM then. What it your real name?
    Stardrive ENGG
    @HighOnDrive
    Thomas J. Buhr, did you get the linkedin connection from me?
    Jean-Jacques Dubray
    @jdubray
    Yes, I did thank you!!
    Bor González Usach
    @bgusach
    @HighOnDrive programming rock band? :D you take this business seriously!!
    Bor González Usach
    @bgusach
    Got a question, how can actions be pure functions if they can call third party APIs which may not be pure? That is not quite the definition of pure functions...
    Bor González Usach
    @bgusach
    And, moreover... they just produce side effects... that is the opposite of function purity
    Jean-Jacques Dubray
    @jdubray
    they are pure fonctions with respect to the model
    It is only with respect to the model
    Bor González Usach
    @bgusach

    Uhm... I don't find it very intuitive to be honest.

    Your idea might be brilliant, but I really can't understand it properly. You talk about pure functions (that return nothing and can perform almost any action), then the equations that describe your model have this term M.present( A(data) ), which I can't understand since the action functions return nothing. I also find kind of confusing that the SAM acronym stands for State-Action-Model, but when I take a look at your examples, I can see there is a fourth element called view (and so far I cant get my head around about the idea that state and model are different things, but maybe because something has not clicked yet in my brain)

    I don't know, I am no specialist in this domain and maybe I'm trying to bite more than I can chew, but I think you have to make your material more didactic. Just my respectful opinion.

    Jean-Jacques Dubray
    @jdubray
    Yes, your point is valid, the difficulty comes from expressing a reactive loop from an expression. Logically the view is computed from that expression. However, the pattern is reactive so it is the action which calls the present function, which can be viewed (and probably should be) a closure on the model.
    All actions as structured as:
    function action(data,present) {
          var data_ = purefunctionAction(data) ;
          present(data_) ;
    }
    And for the model:
    function present(initialState) {
          var model =initialState  ;
    
          return ( function (data) {
    
                  ... implementation of the present method ...
          } ) ;
    
    }
    Jean-Jacques Dubray
    @jdubray
    Again, there is only so much you can express in a single expression, hopefully it still helps to understand the pattern.

    I think you have to make your material more didactic.

    yes, but that only happens over time, as people ask question and I understand where the disconnects happen

    The View is the "State" representation. It is totally subject to the "State", it cannot stand on its own. I believe that has been one of the root cause of all MVX patterns, it is best to think in terms of business logic only because the view has none, that's why the pattern is not called VSAM (disclosure doesn't sound as good). That being said, V, the state representation, can actually be anything, SAM is really the pattern.
    Stardrive ENGG
    @HighOnDrive

    @bgusach Progressive rock band and then a programming rock band in the form of a software project, best of both worlds :smile:

    I understand where you are coming from about not finding SAM the easiest think to understand. Myself I'm here because I have discovered a pattern myself and find them very useful in managing complex reactive flows.

    For sure there is a real need for a pattern to emerge that supersedes the half-full boiler plate oriented narrow boxes that frameworks try to lure you into, until you discover that circles just will not fit into squares, much to your dismay and against all the hype.

    For me the SAM acronym itself makes sense because state drives all actions which affect models. That's how it lines up with how I define and use control states anyways.

    Stardrive ENGG
    @HighOnDrive

    I think a nice top to bottom comparison table with one column per pattern/framework would be a helpful way to see the purpose of SAM. Just a succinct breakout of how different options handle the reactive loop and interact with the model, be it on the client or the backend.

    Then after that is clear then various ways of wiring can be highlighted. Then finally code examples follow from that. The SAM pattern becomes lost in the shuffle so to speak if implemented in a specific wiring option before the comparison table is acturately presented.

    This whole flow of revealing what SAM is follows a model (comparison table) then state (resulting wire options) then view (wired up code samples) format as well.

    Jean-Jacques Dubray
    @jdubray
    Thank you Tom. I have actually the first table for React: http://jdubray.github.io/sam/#react
    @gunar also shared an interesting video from the React Conference which started at ... V = f(M) and went on to compare React with other frameworks. https://www.youtube.com/watch?v=Pm0uwncSCo4&feature=youtu.be&t=14366
    Esteban Negri
    @enbits
    Here's the standalone talk from Andrew Clark: https://www.youtube.com/watch?v=ZVYVtUFDf28
    Jean-Jacques Dubray
    @jdubray
    thank you, I'd really be curious if he read the article prior to preparing his slides.
    Esteban Negri
    @enbits
    I'm watching it for the first time and I see what you mean
    Jean-Jacques Dubray
    @jdubray
    I say that because in everything I had read about React prior to the article, I had never seen someone saying react is v = f(d), and for me that was the ah ah moment that started everything. Once you understand that it's that simple, then you want/can close the loop.
    The react component model itself does not offer a good way to close the loop that's why they ended up adding Flux/Redux, then Thunks then Sagas, then GraphQL, then Relay...
    that's a bit too much, if they had started with v = f(d) (and JSX) they probably would have created something that was 99% simpler.
    You also see from his presentation that stream don't really add much to the architecture:
    v$ = f(d$) or v[] = f( d[] ) does not change anything, just some wiring.
    IMHO, react is out of control
    Esteban Negri
    @enbits
    That's what confusing me lately. Seems like the big ones (I mean, Google, Facebook, etc) doesn't know what to do. I'm pretty new at these Javascript frameworks and I wanted to use Angular as a base for all future developments, but with all this Angular 2 ramble I'm really lost and I thought it was just me, then found your article.
    And PHP frameworks keep working with MVC so that adds more confusion when people talk about using Angular + Laravel to build apps
    Jean-Jacques Dubray
    @jdubray
    They sure don't make it easy. I say SAM gives you a good enough structure to start with, you can choose how much framework you really need on top of that.
    For the sad part is all these frameworks tend to obscure the value of HTML5/CSS3 because they want you to use plain vanilla HTML
    Esteban Negri
    @enbits
    Well I like minimal stuff and Angular is a monster, never understood V1. So what are the key js libs that I should use if I want to implement SAM?
    Gunar Gessner
    @gunar
    You don't need absolutely any lib to implement SAM. That's the beauty of it.
    That being said, I like myself some React (or any other VirtualDOM lib) for the View.
    NB: There is no V in SAM, so it's really a matter of taste and doesn't change anything.
    Jean-Jacques Dubray
    @jdubray
    +1, you can use anything for V, Stateless React Component I believe are pretty good. You can take a look at the sample list: http://sam.js.org/#rocket
    Esteban Negri
    @enbits
    Thanks guys!
    Aliaksei Kuncevič
    @kuncevic
    This message was deleted
    dnson
    @imnutz

    @jdubray my another attempt using SAM to build webapp :relieved:
    https://github.com/imnutz/dashboard

    In this, I tried to split the webapp into folders and components.
    May you take a look?

    Jean-Jacques Dubray
    @jdubray
    sure, you are amazing! thank you for all your contributions.
    Jean-Jacques Dubray
    @jdubray
    the actions are about validating and enriching
    It looks great except for one thing, I would not put the CRUD operations (services) in the actions and call these actions from nap(). Logically this is truly what happens but IMHO, it is better when the model persists its values
    There could be some race conditions that occur when you handle the persistence with nap()